WMI VBScript terminating a process question



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


Willy Denoyette [MVP]

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


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question