''@ Example Call KillProcess("Iexplore.exe")
''---------------------------------------------------------------------------------------------------------------------------
Sub KillProcess(strProcessName)
strComputer=environment.Value("LocalHostName")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
strQuery="Select * from Win32_Process Where Name ='"&strProcessName&"'"
Set colProcesses = objWMIService.ExecQuery (strQuery)
For Each objProcess in colProcesses
objProcess.Terminate()
Next
End Sub
''---------------------------------------------------------------------------------------------------------------------------
Sub KillProcess(strProcessName)
strComputer=environment.Value("LocalHostName")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
strQuery="Select * from Win32_Process Where Name ='"&strProcessName&"'"
Set colProcesses = objWMIService.ExecQuery (strQuery)
For Each objProcess in colProcesses
objProcess.Terminate()
Next
End Sub
No comments:
Post a Comment