Check to see if a program is running

Comments

3 comments

  • Shawn Anderson

    There isn't a way to check for a running program from within PDQ, however there are a few other options that may also work.

    1. Write a .bat script and run it as the first step. It would check for a running process or service and then exits with a exit code 1 so that following steps will not run.

    2. Do a check if a user is logged on and if so end the install. This can be done in the Conditions tab of an install step. (Logged On State).

    3. Just include a step that will kill any browser before running Flash install. Because it would kill any browser it would be recommended to schedule the install for after hours so that you don't inconvenience users.

    0
    Comment actions Permalink
  • james matson

    here is what I'm trying:  (This is a powershell step prior to any deployment steps)

    stop-process -ProcessName "t" -whatif 

    Success code is -37104

     

    If powershell doesn't find the process named "t" it throws an error and provides us exit code -37104, which we define in the step as success.  If it does find it, it just runs the -whatif and provides us with exit code 0 -- which we omit from the success codes.  My issue is that if people are using the program and we kill the process, records will get locked in the database... 

    0
    Comment actions Permalink
  • GrantG

    If you know the details of what you're looking for, here's what I'm using:

     

    Command step configured to "Stop Deployment with Error":

    tasklist /FI "IMAGENAME eq notepad.exe" | find /I /N "notepad.exe"

    Success Codes: 1

    If notepad.exe is running, it will fail, and stop the deployment.  If it's not, it will continue to the next step.

    And you can search for more than that: https://ss64.com/nt/tasklist.html

    Hopefully that helps.

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.