I am trying to kill a process for the user who is logged onto a server. once they close a certain exe that I am monitoring then it need to kill off all other iexplore.exe windows created by that user. I have found this code so far.
Thanks for taking the time to help!
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
Wscript.Echo "Process " & objProcess.Name & " is owned by " _
& strNameOfUser & "."
Next
Comments