Quantcast
Channel: Shavlik User Community : Document List - All Communities
Viewing all articles
Browse latest Browse all 1352

Custom Action - How to Work with Batch Files

$
0
0

Symptoms


When running a batch file as part of a custom action, the deployment never completes or the deployment hangs.

 

Cause


When Protect is running 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 Protect Generated Batch. When the Protect Generated Batch file is running, it initiates each task sequentially going through the list (one task must finish before the next can begin). When the Protect Generated Batch file calls the users custom batch file, the Protect Generated Batch file waits for the users custom batch file to return an exit code to indicate it is done. If the users' custom batch file is not accessed with an appropriate command, it will not return the necessary exit code for the Protect Generated Batch File 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 Protect Generated Batch file 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 Protect Generated Batch file will continue without waiting for the custom batch file to close.


Example:

 

Start %PATHTOFIXES%\show_warning.bat

 

These are CMD commands, not Shavlik custom variables. More info on CMD commands here: An A-Z Index of the Windows CMD command line | SS64.com

 

We would 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 Server 9.x
Shavlik Protect 9.x


Viewing all articles
Browse latest Browse all 1352

Trending Articles