Jump to content

Recommended Posts

Posted

In my unattended CD I have spybot S&D install & schedule it to scan every 5 days. I want to be able to determine if a certain process is running & act accordingly. My problem is this... I have several computers that cannot be interrupted (scan would cause them to fail) while a certain process is running. I want a batch file to check for a certain process.. if it see's it I would like to remove & reschedule the scan. If it is not running I would like it to run the already scheduled task. Any help or suggestions would be appreciated.


Posted

Copy and paste the following in a .vbs file and see if this could be used for your needs. The script checks for if Notepad.exe is running or not.

Simply edit the Process name as per your requirement to check if the process is running or not.

CODE:

strProcess = "Notepad.exe"

Set objWMIService = GetObject("winmgmts:")

Set colProcessList = objWMIService.ExecQuery _

("SELECT * FROM Win32_Process where name='" & strProcess & "'")

CheckProcess=(colProcessList.Count > 0)

If CheckProcess = -1 Then

Msgbox "Notepad is running"

Else

Msgbox "Notepad is NOT running"

End If

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...