Salutations,
I have the following VBScript:
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strList
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in colProcess
MsgBox(objProcess.ExecutablePath)
'If InStr(objProcess.ExecutablePath, "EASE") <> 0 Then
' MsgBox("TERMINATING")
' objProcess.Terminate()
'End If
Next
For some reason I get an error on the line MsgBox(objProcess.ExecutablePath). It says "Invalid use of Null: 'ExecutablePath'". Oddly enough I do not get this error when I uncomment the commented lines and comment out the problem line.
As you can see I am trying to terminate all processes with a certain path name, but it appears that the string matching isn't working, like there is something wrong with the executable path.