WMI VBScript terminating a process question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Friends,
I apologize for posting this in the C# newsgroup. I
posted this question in the dotnet.scripting newsgroup
and got no response. If anyone of you is familiar with
VBScripting, kindly help me. Thanks a lot in advance.

The following script executes with no errors. However, it
does not terminate the process. Any ideas or suggestions
is appreciated.

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



..
 
How would you know it runs without errors if you don't check the return
value of objProcess.Terminate().
Note that the appropriate NG for WMI is
microsoft.public.win32.programmer.wmi.

Willy.
 
Back
Top