Kill process (VBScript)
This code can be found in
Chapter 6 of Windows Server Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' This code terminates the specified process.
' ---------------------------------------------------------------
' From the book "Windows Server Cookbook" by Robbie Allen
' ISBN: 0-596-00633-0
' ---------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------
intPID = 2560 ' PID of the process to terminate
strComputer = "."
' ------ END CONFIGURATION ---------
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
|
This code has been viewed 9370 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|