print
|
close
Q: How can I check for a process by using VBScript?
Windows IT Pro
John Savill
John Savill
Thu, 09/08/2011 - 11:00pm
A: The script below checks for a given process and reports if it’s running by scanning through all running processes.
Replace the procName “winword.exe” with the image you wish to check for and replace the logic if the process is found with your own requirements.
set objWMIService = GetObject ("winmgmts:")
foundProc = False
procName = "winword.exe"
procNameFriend = "Word"
for each Process in objWMIService.InstancesOf ("Win32_Process")
If StrComp(Process.Name,procName,vbTextCompare) = 0 then
foundProc = true
End If
Next
If foundProc = True Then
WScript.Echo "Found Process"
End If
Syndicate
Source URL:
http://windowsitpro.com/systems-management/q-how-can-i-check-process-using-vbscript