Hello all, I recently pulled a script to shut down a process, however when you achieve one thing more comes along.
I have the following lines of code which shut down a single process. Whenever I attempt to add more than one value to my select statement it wont shut down any processes.
Here is the code I'm using which was on the microsoft script site.
Set oWmi = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
query = "Select * from Win32_Process where name = 'notepad.exe'"
'query = "Select * from Win32_Process where name like Iexplore.exe"
Set wql = oWmi.execQuery(query)
For each item In wql
item.terminate()
next
Set wql = Nothing
Set owmi = Nothing
This code only works for a single process and it's becomming a hassle because Ive used Select to query more than one item in the past
I have the following lines of code which shut down a single process. Whenever I attempt to add more than one value to my select statement it wont shut down any processes.
Here is the code I'm using which was on the microsoft script site.
Set oWmi = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
query = "Select * from Win32_Process where name = 'notepad.exe'"
'query = "Select * from Win32_Process where name like Iexplore.exe"
Set wql = oWmi.execQuery(query)
For each item In wql
item.terminate()
next
Set wql = Nothing
Set owmi = Nothing
This code only works for a single process and it's becomming a hassle because Ive used Select to query more than one item in the past