Pages

Showing posts with label terminate process vbscript. Show all posts
Showing posts with label terminate process vbscript. Show all posts

Monday, 29 August 2011

VBScript to Terminate Process

Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill 
strProcessKill = "'ProcessName.exe'" 
Set objWMIService = GetObject("winmgmts:root\cimv2") 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next 
WScript.Quit