Q: How can I check for a process by using VBScript?

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
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish