Trying to kill a process but won't let me kill it. I'm an Administrator on the box, so I am at loss. Using the code below I am getting "Error code 2" when it tries to kill it. Please note I am only trying to kill notepad.exe as a test.
Thanks
Thanks
Code:
intPID = 3204
strComputer = "server"
WScript.Echo "Process PID: " & intPID
set objWMIProcess = GetObject("winmgmts:\\" & strComputer & _
"\root\cimv2:Win32_Process.Handle='" & intPID & "'")
WScript.Echo "Process name: " & objWMIProcess.Name
intRC = objWMIProcess.Terminate()
if intRC = 0 Then
Wscript.Echo "Successfully killed process."
else
Wscript.Echo "Could not kill process. Error code: " & intRC
end if