Check to see if program open before deploying application



  • Shane Corellian

    Yes, you can do this in the Pro mode of PDQ Deploy. In the current version It is kind of a round-about way of doing it, kind of like using TaskKill. In this case you could use TaskList.exe to see if the application is running. If it is, it will exit with a 0 error code. Code 0 is generally considered a success but if you change the Successful Return Codes value to include 1 and not 0 then it would work. For example, to see if winword.exe is running you could use a command step with the following command.

    %WINDIR%\System32\tasklist /FI "IMAGENAME eq winword.exe" | find /I /N "winword.exe"

    If you want to terminate the deployment because this process is running then have the Success Codes field only contain the number 1. (Remove the default 0) Under Options make sure the Error Mode is set to Stop Deployment with Error. 

    Comment actions Permalink
  • Joel Johnson

    Thanks Shane. Seems to have done the trick. I had found something similar on a website somewhere but the syntax was different and was never consistent in its results across different machines.

    Comment actions Permalink

Please sign in to leave a comment.