Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to kill few application ?

Status
Not open for further replies.

bolobaboo

MIS
Aug 4, 2008
120
US
Hi
I want to kill few application using following script. But it throws out error out at line 6 ..
Any idea what i am missing ?

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name IN ('cmd.exe','dsmc.exe','dsmclc.exe')")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
 
I don't think IN is supported; try:

Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'cmd.exe' OR Name = 'dsmc.exe' OR Name = 'dsmclc.exe'")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top