Friday, July 11, 2008

VbScript To Kill Process in Windows 2000/XP/Vista

Ever wonder is there a better way to kill process like iexplore.exe which hangs when your Internet Explorer just freeze and wont do anything and your taskmgr is just too stubborn and does not want to show up immediately in front of you!!

Well here is the vbscript u can use to kill it the iexplore.exe You can replace the variable iexplore.exe with any process you want..cheers happy killing!!!

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next

2 comments:

Ben said...

Thanks, this is way better than playing whack-a-mole with task manager

Anonymous said...

can you kill a certain iexplore process?
let's say you have 3 processes running, how can you kill just one of them?