<p>I have multiple users running attachemate on a Windows 2003 server.  I want to kill attachemate.exe started by user_1 without killing attachemate.exe started by user_2.</p>

<p>I want to use VBScript.</p>

[{'answer_id': 76309, 'author': 'Colin Neller', 'author_id': 12571, 'author_profile': 'https://Stackoverflow.com/users/12571', 'pm_score': 2, 'selected': False, 'text': '<p>Shell out to pskill from <a href="http://sysinternals.com/" rel="nofollow noreferrer">http://sysinternals.com/</a></p>\n\n<p>Commandline: pskill -u user_1 attachemate.exe</p>\n'}, {'answer_id': 89397, 'author': 'unrealtrip', 'author_id': 11130, 'author_profile': 'https://Stackoverflow.com/users/11130', 'pm_score': 4, 'selected': True, 'text': '<p>You could use this to find out who the process owner is, then once you have that you can use  Win32_Process to kill the process by the process ID.</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/aa394372.aspx" rel="noreferrer">MSDN Win32_Process class details</a></p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/aa393907(VS.85).aspx" rel="noreferrer">MSDN Terminating a process with Win32_Process</a></p>\n\n<p>There is surely a cleaner way to do this, but here\'s what I came up with.  NOTE: This doesn\'t deal with multiple processes of the same name of course, but I figure you can work that part out with an array to hold them or something like that. :)</p>\n\n<pre><code>strComputer = "."\nstrOwner = "A111111"\nstrProcess = "\'notepad.exe\'"\n\n\' Connect to WMI service and Win32_Process filtering by name\'\nSet objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\" _\n    &amp; strComputer &amp; "\\root\\cimv2")\nSet colProcessbyName = objWMIService.ExecQuery("Select * from Win32_Process Where Name = " _\n    &amp; strProcess)\n\n\' Get the process ID for the process started by the user in question\'\nFor Each objProcess in colProcessbyName\n    colProperties = objProcess.GetOwner(strUsername,strUserDomain)\n    if strUsername = strOwner then\n        strProcessID = objProcess.ProcessId\n    end if\nnext\n\n\' We have the process ID for the app in question for the user, now we kill it\'\nSet colProcessList = objWMIService.ExecQuery("Select * from Win32_Process where ProcessId =" &amp; strProcessID)\nFor Each objProcess in colProcess\n    objProcess.Terminate()\nNext\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/76275', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9882/']