To kill processes in Windows
strComputer = "."
strProcessToKill = InputBox("Task Killer!!! ","Enter process name to kill!")
'strProcessToKill="wmplayer.exe"
'strProcessToKill="excel.exe"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & strProcessToKill & "on " & strComputer
No comments:
Post a Comment