Processing software distribution custom scripts

Custom scripts that control scheduled tasks (Tools > Distribution > Scheduled tasks) are processed in three sections:

  • Premachine: The Premachine section of the custom script is processed first, and only once at the start of the task. Use this section for tasks that have no targeted device, and/or for Targeted Multicast. During the Premachine section of the script, only local commands, LOCxxx, should be used.
  • Machine: The commands in this section of the script run second and only once per targeted device. These commands can use either the remote or local execution commands, and are primarily used for remotely executing SDCLIENT.EXE. Before the commands in this section of the script can be performed, the SWD agent must be installed on the targeted devices.
  • Postmachine: This section is processed last, and again, only once after all devices have been processed. Software distribution does not add commands to this section, and it only supports the local commands, LOCxxx. The commands in this section won't be processed if devices in the task can't run them. The InventoryScanner.ini script that comes with Endpoint Manager contains details about the script commands.

Custom Script Commands

Custom scripts support various local and remote commands:

  • LOCEXEC: Local execute, this command is used to execute an application on the local device, which is always the core server.
  • LOCDEL: Local deletion, deletes a file on the local device.
  • LOCMKDIR: Local make folder, creates a folder on the local device.
  • LOCRD: Local remove folder, this command is used to remove a folder on the local device.
  • REMCOPY: Remote copy, copies a file from the local device to a remote device.
  • REMEXEC: Remote execution, executes an application on the specified remote device.
  • REMDEL: Remote deletion, deletes a file on the remote device.
  • REMMKDIR: Remote make folder, this command creates a folder on the remote device.
  • REMRD: Remote remove folder, this command deletes a folder on the remote device.

HTTP and UNC paths in scripts

These are examples of software distribution .ini files that reflect the differences between HTTP and UNC path script files.

HTTP path script file:

; This file was generated by Desktop Manager


REMEXEC0=C:\Program Files\LANDesk\LDClient\sdclient.exe -p=http://<web server>/packages/test package.exe -g={6DD454C0-11D3A0D1-a000B3B5-9BACBBC99CFC6D-9CE3504801A0D4B2FZ0829F08} -Ac -Ab

UNC path script file:

; This file was generated by Desktop Manager


REMEXEC0=C:\Program Files\LANDesk\LDClient\sdclient.exe -p=\\sample_core\onefile\test package.exe -g={6DD454C0-11D3A0D1-a000B3B5-9BACBBC99CFC6D-9CE3504801A0D4B2FZ0829F08} -Ac -Ab

Notice that both .ini files have similar elements. In the MACHINES section, the -P option designates the path where the device will download the software package. In the HTTP example, the path is http://<web server>/packages/test package.exe.

The next option is the -G option, which is the GUID, a unique number identifier for each package. This number identifier is generated by the Package Builder, and it helps prevent confusion during installation between packages with similar names.

Scripting guide for deployment scripts (.ini) files

You don't have to use the Create software distribution script window to create the deployment script file. A deployment file is an .ini file containing the settings the device should use for installing a package. You can create your own deployment files in a text editor such as Notepad if you prefer.

A software distribution .ini script file has these components:


REMEXEC0=C:\Program Files\LANDesk\LDClient\sdclient.exe





REMEXEC0 command parameters

The parameters for the REMEXEC0 command have been placed on separate lines to make the components more visible. When placed in an .ini file, the command needs to be on one line.

REMEXEC0 is the Remote Execute command. If you want to use more than one REMEXEC0 command in a single script file, increment the command each time it is used. For example, if you used three REMEXEC calls in a single .ini file, they should be REMEXEC0, REMEXEC1, and REMEXEC2. These commands don't need to increment if they're in separate files.

The C:\Program Files\LANDesk\LDClient parameter is the correct path to the SWD agent.