Symptoms
When running a batch file as part of a Custom Action, the deployment hangs and never completes.
Cause
When Patch for Windows Servers (PWS) builds a deployment, it creates a batch file that is copied to the target machine. This batch file contains all the information related to that deployment, including what patches should run and with what switches. It also includes any Custom Actions that the user defined. This batch file will be referred to as the PWS Generated Batch. When the PWS Generated Batch executes, it initiates each task sequentially going through the list (one task must finish before the next can begin). When the PWS Generated Batch calls the user's custom batch file, the PWS Generated Batch waits for the user's custom batch file to return an exit code to indicate it is done. If the user's custom batch file is not accessed with an appropriate command, it will not return the necessary exit code for the PWS Generated Batch to continue through its pending actions.
Solution
If the Custom Action batch file is going to run an action that following actions are dependent on (example: batch file stops a service so a custom action can run a .exe), then utilize the CALL command.
The call command will allow the custom batch file to return an exit code to the PWS Generated Batch so it can continue on its jobs, once the custom batch file finishes.
Example:
Call %PATHTOFIXES%stop_services.bat
If the Custom Action batch file is going to present the end user with information that should stay open (example: a custom message that the batch file shows), then utilize the START command.
The Start command will begin the custom batch file, and once it has started, the PWS Generated Batch will continue without waiting for the custom batch file to close.
Example:
Start %PATHTOFIXES%show_warning.bat
These are CMD commands, not Ivanti custom commands. More info on CMD commands here: An A-Z Index of the Windows CMD command line | SS64.com
Unless a different order is required, we generally recommend having your batch file run "After All Patches" rather than "Before All Patches" to avoid any conflicts with patches being installed in the deployment.
Related Documents
Custom Action - Using the Null Patch
Affected Product(s)
Ivanti Patch for Windows Servers 9.x
Ivanti Security Controls