Launching a command task file

After you create a CMDTask file and the task is displayed on the IBM Director Console under the External Application Launch task, you can start the task in the same ways as you start any other IBM Director task.

For targeted tasks, drag the task onto a managed system. For non-targeted tasks, double-click on the task or open it with a right mouse click. When you start the task, the IBM Director Console launches the program specified on the appropriate “CommandString” line in the CMDTask file. However, if the task is targeted, several special environment variables can be set before the program is launched – this allows the targeting information to be passed to the program.

Special environment variables:

Variable Name Description
CMDTASK_IP_ADDRESSi

This variable retrieves the IP Address of the targeted system. Because a targeted system could have multiple IP addresses, the i should be replaced with 0, 1, 2, … beginning with zero as the first adapter for the targeted system.

Example: CMDTASK_IP_ADDRESS0

CMDTASK_MAC_ADDRESSi

This variable retrieves the MAC Address of the targeted system. Because a targeted system could have multiple MAC addresses, the i should be replaced with 0, 1, 2, … starting with zero as the first adapter for the targeted system.

Example: CMDTASK_MAC_ADDRESS0

CMDTASK_COMPUTERNAME The NetBIOS name for the targeted system.
Usage Recommendations:
  • Execute CommandString.Windows and CommandString.Unix values from a command line first to ensure that it executes successfully outside of the CMDTask file. This saves debugging efforts.
  • If the launched application requires an interactive dialog or advanced command line syntax, such as wildcard expansion, set the ShellRequired parameter to true. Without the ShellRequired parameter set to true (the default is false), the CommandString is just executed. Any output is shown in a window that can you can scroll and later close. Also, if it takes awhile to launch the application, specify a Timeout value in seconds to handle the time it takes to launch the application.
  • When using the environment variables, CMDTASK_IP_ADDRESSi and CMDTASK_MAC_ADDRESSi, always remember to append a number at the end. If it is for the first adapter, append 0 to the variable.
  • When a CMDTask is defined on the IBM Director Server, it is displayed on IBM Director Consoles. However, to launch the command (application) successfully, the necessary applications or files must also reside on the IBM Director Console machine as well.
  • Because .CMDExt files are Director properties files, if any parameter is defined more than once, only the last definition found is used.
  • When editing the .CMDExt file (properties file), ISO8859-1 character encoding is used. For characters that cannot be represented directly in this encoding, Unicode escapes are

    used. However, only a single "u" character is allowed in an escape sequence.
(C) Copyright IBM Corporation 1999,2005. All Rights Reserved.