Client Automation - Exit Code 1 When Delivering a Software Package Containing a Batch File.
search cancel

Client Automation - Exit Code 1 When Delivering a Software Package Containing a Batch File.

book

Article ID: 3900

calendar_today

Updated On:

Products

CA Client Automation - IT Client Manager CA Client Automation CA Client Automation - Software Delivery

Issue/Introduction

When delivering any software package containing a batch file, the result is always "Exit code 1 indicates possible error", even though the batch file runs fine when tested locally. The problem happens even with the most trivial batch files, that are verified not to contain any syntax errors, or reasons for exiting with code 1.

Here's what you might notice if the software delivery job check window is visible:
 
 
Here's what you'll see in DSM Explorer, showing the job failed with "Exit code 1 indicates possible error":
 
 
Here's a snippet from the SD Agent log on the target computer:
(Note: Some of the less relevant traces have been removed)
 
NOTIFY | Running SD job 1: Software Delivery Test Send Test [Visible] 1.0
INFO   | Procedure to run Test.cmd
INFO   | Checking procedure extensionINFO   | There is no extension handler for the .cmd extension
INFO   | Current directory should be C:\Program Files (x86)\CA\DSM\SD\tmp\activate\28C55EB4-3661-4231-BFAD-41F327DA48DA.itm\1.vol
INFO   | Current directory is C:\Program Files (x86)\CA\DSM\SD\tmp\activate\28C55EB4-3661-4231-BFAD-41F327DA48DA.itm\1.vol
NOTIFY | GetBinaryType() failed
INFO   | Execute:Test.cmd > C:\PROGRA~2\CA\DSM\Agent\units\00000001\usd\sdjexec\6E566A57-5BCD-4C73-AF58-5682FB4F1460.res, timeout:21600000ms
NOTIFY | SDjob 1 returns: 1 ExitCode: 1
NOTIFY | Execution not OK

Environment

Client Automation - All Versions

Cause

The problem is caused by the presence of a registry value named 'AutoRun' on the target computer:
 
For 32-bit computers:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\AutoRun
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\AutoRun
 
For 64-bit computers:
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Command Processor\AutoRun
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Command Processor\AutoRun
 
Each time a Command Window (cmd.exe) is launched, the contents of this registry value is read and executed immediately.
 
One example might simply be "cd\":
 

When the software delivery agent attempts to execute the batch file, an arbitrary "cd\" command is first given, changing the working directory away from the location of the batch file. The result is Exit Code 1 as the batch file is not present in the new current directory.

Resolution

The solution is to delete the AutoRun value from the Command Processor registry key. Once the value is removed, Software Delivery jobs containing batch files will be able to execute successfully.