Abort deployment if specific process is running
Trying to figure out the best way to use "tasklist" thru command option, to abort a deployment if a specific process is running. For example, the latest release of DC Reader will be replacing all of our current Reader XI installs. To do this I want the package(in step 1) to run tasklist and find the process of AcreRd32.exe , and if it is running, to cancel/abort package altogether. I've come close but the command and return code ended up cancelling the package every single time. Any suggestions would be appreciated!
Comments
Correction *AcroRd32.exe*
Omar,
I assume that you could just do this as a command step and the first step in your package (I used Foxit Reader for my test since that's what I have installed):
-----
set ProcessName=FoxitReader.exe
tasklist | find /i "%ProcessName%"
exit /b %ErrorLevel%
-----
Then you would set "Success Codes" in that step to "1" since you will get an ErrorLevel of 1 if the process is not found.
You will get an ErrorLevel of 0 if the process is found. Since "0" will no longer be in the "Success Codes" field that should cause the deployment to stop with an error.
Then go into the Options of that step and set Error Mode to "Stop Deployment with Error"