How to terminate process using VBScript

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2009-05-21T14:33:06Z Indexed on 2010/03/23 4:11 UTC
Read the original article Hit count: 279

Filed under:
|
|

Hi,

I have this VBScript code to terminate one process

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

it works fine with some processes, but when it comes to any process runs under SYSTEM, it can't stop it.

Is there is anything I need to add to kill the process under SYSTEM?

Thanks

© Stack Overflow or respective owner

Related posts about vbscript

Related posts about Windows