End a process run by another user Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Araphen
Posts: 5
Joined: 20 Apr 2024, 05:22

End a process run by another user

Post by Araphen » 22 Apr 2024, 17:25

So at work I made some automation involving a program called wintegrate and for some reason wintegrate won't run if microsoft.sharepoint.exe is running. I checked the details tab in task manager and found wintegrate and looked at its wait chain which said it was waiting on microsoft.sharepoint.exe. If i end microsoft.sharepoint.exe, wintegrate opens.

So i made a script that finds microsoft.sharepoint.exe's PID and closes it.
But the problem is if another user is logged into the computer, they'll have an instance of microsoft.sharepoint.exe running as well. My script will see that, try to close it, fail, and wintegrate can't open. I can manually go into task manager and close the process, but that defeats the purpose of my automation. And running my script as administrator doesn't work either.

Does anyone know how to end processes running under other users? Or how to end processes under only my user, that might also work but I'm not sure.

Here's what I have so far which can end microsoft.sharepoint.exe processes under my user but only as long as I'm alphabetically first in task manager, which I never am unless I'm on the only user signed on.

Code: Select all

processToClose = Microsoft.SharePoint.exe
Loop
	{
	if (A_index = 50)
		{
		errorState = 1
		break
		}
	SetTitleMatchMode 2
	Process Exist, %processToClose%
	PID := ErrorLevel
	;msgbox, PID = %PID%
	if (PID = "0")
		{
		break
		}
	Process, close, %PID%
    }
	
if (errorState = "1")
	{
	msgbox, failed to close all instances of %processToClose%
	}
else
	{
	msgbox, All instances of %processToClose% have been closed.
	}

RussF
Posts: 1311
Joined: 05 Aug 2021, 06:36

Re: End a process run by another user

Post by RussF » 23 Apr 2024, 06:30

If your organization is dependent on Sharepoint, I don't think it is a process that you should just indiscriminately kill, especially when in use by others logged in to the device.

My first recourse would be to contact Rocket Software and find out exactly why it won't run with Sharepoint. It may not be Sharepoint at all and there may be another work-around.

Russ

Araphen
Posts: 5
Joined: 20 Apr 2024, 05:22

Re: End a process run by another user

Post by Araphen » 23 Apr 2024, 19:04

RussF wrote:
23 Apr 2024, 06:30
If your organization is dependent on Sharepoint, I don't think it is a process that you should just indiscriminately kill, especially when in use by others logged in to the device.

My first recourse would be to contact Rocket Software and find out exactly why it won't run with Sharepoint. It may not be Sharepoint at all and there may be another work-around.

Russ
Our organization doesn't depend on sharepoint, it's just tagged along with other microsoft stuff we have installed.

Araphen
Posts: 5
Joined: 20 Apr 2024, 05:22

Re: End a process run by another user  Topic is solved

Post by Araphen » 24 Apr 2024, 12:27

I found a solution but it isn't super elegant

Make a batch file:

Code: Select all

Taskkill -im "Microsoft.SharePoint.exe" /f /t
then stick that batch file wherever and make a shortcut to it. Then right click the shortcut, properties, shortcut tab, advanced, check "run as administrator", okay, apply
then in ahk, run that shortcut however many times is needed to kill all Microsoft.sharepoint.exe processes

Post Reply

Return to “Ask for Help (v1)”