Software Delivery Job: Start a Command in 64 bit Mode

Document ID : KB000031305
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

By default SD Agent executes the jobs of type "Command file" with a cmd (Command interpreter) in 32 bit mode.

Sometimes it is necessary to execute the command file in 64 bit mode.

How to execute a "command file" SD job in 64 bit mode:

 

Solution 1:

In the Configuration policy it is possible to specify the bit mode (32 or 64 bit) for Command interpreter :

DSM/Software Delivery/Agent/File Association: Command interpreter bit mode :

 

Configuration Policy

 

 

This parameter is "locally Managed" but it is possible to make it "Centrally Managed" and change the settings in a Configuration Policy applied on a group of machines.

In Locally Managed mode, it is possible to update the value directly on the agent machine with this command :

ccnfcmda -cmd SetParameterValue -ps itrm/usd/agent -pn cmdBinaryMode -v "64 bit"

 

The value could be checked with this command :

ccnfcmda -cmd GetParameterValue -ps itrm/usd/agent -pn cmdBinaryMode

 

 ccnfcmda

 

 

Solution 2:

The disadvantage of Solution 1 is that all "command file" SD jobs will be executed in 64 bit mode.

If we need to execute the command interpreter in 64 bit for only one or few SD jobs we could let the cmdBinaryMode to default value (32 bit) and create a .cmd file containing following code :

 

@echo off
setlocal 
SET PROCESS_64=0
SET CPU_64=0
IF DEFINED ProgramFiles(x86) (
   SET CPU_64=1
   IF NOT %PROCESSOR_ARCHITECTURE% == x86 SET PROCESS_64=1
   IF DEFINED PROCESSOR_ARCHITEW6432 SET PROCESS_64=0

)

SET CMD_PATH=%SystemRoot%\system32
IF %CPU_64% EQU 1 (
   IF %PROCESS_64% EQU 0 SET CMD_PATH=%SystemRoot%\sysnative
)
%CMD_PATH%\cmd /C script_to_launch_in_64_bit.cmd
endlocal

 

 

Replace script_to_launch_in_64_bit.cmd by the command to execute in 64 bit.

Add this script in the SD Package and use it for the SD Procedure.

 

Remarks: 

PROCESS_64 is a flag to indicate if the process is running in 32 or 64 bit mode. 

CPU_64 is a flag to indicate if the OS is 64 bit or 32 bit.

If the OS is 64 bit and process is 32 bit, cmd.exe is executed from path %SystemRoot%\sysnative (which is redirected to 64 bit system32 directory).