Next Topic

Previous Topic

Book Contents

Variable Manager

Use the Variable Manager to define variables that can be used repeatedly in different scripts. You can maintain multiple values for each managed variable, with each value applied to one or more group IDs. Managed variables cannot be re-assigned new values within a script. Within a script, reference a managed variable by bracketing the variable name with the < and > character. Example: <VariableName>.

Using managed variables, managed machines can run scripts that access locally available resources based on the group ID or subgroup ID.

Note: Using System > Naming Policy, this benefit can be applied automatically by IP address even to a highly mobile workforce that travels routinely between different enterprise locations.

Using Variables

Use variables to store values that can be referenced in multiple script steps. Variables are passed automatically to nested scripts.

  • Two Methods for Creating Variables:
    • Script Variables - Use the Get Variable command within a script to create a new variable name without any special characters. Example: VariableName. In subsequent steps, including steps in nested scripts, reference the variable by bracketing the variable name with the # character. Example: #VariableName#. Scripts variables cannot be referenced outside of the script or nested scripts that use them.
    • Managed Variables - Use the Variable Manager to define variables that can be used repeatedly in different scripts. You can maintain multiple values for each managed variable, with each value applied to one or more group IDs. Managed variables cannot be re-assigned new values within a script. Within a script, reference a managed variable by bracketing the variable name with the < and > character. Example: <VariableName>.
  • Where Used - Once variables are created you can include them, in their bracketed format, in any text entry field displayed by an IF-THEN-ELSE dialog box.
  • Case Sensitivity - Variable names are case sensitive.
  • Reserved Characters - Because the <, > and # characters are used to identify variable names, these characters must be entered twice as regular text in a command line. For example the following command c:\dir >> filelist.txt is interpreted at script runtime as c:\dir > filelist.txt.
  • Types of Variable Values Possible - The following are the types of variable values typically obtained by using the Get Variable parameter.
    • Registry Value - Data from the specified registry value on the managed machine.
    • File Content - Data from a specified file on the managed machine.
    • Constant Value - Specified constant as typed in the script editor.
    • Expression Value - Specify an expression that consists of script variables and six mathematical operators +, -, *, /, (, and ) that are evaluated and assigned to a new script variable. For example, ((#variable1# + #variable2#) + 17.4) / (#variable3# * 4). The script variables must contain numeric values.
    • Agent Install Directory Path - Directory in which the agent is installed on the managed machine.
    • Agent Install Drive - Drive in which the agent is installed on the managed machine, such as c:\.
    • Agent Temp Directory Path - Temporary directory on the managed machine as specified on the Temp Directory function on the agent tab.
    • User Temp Directory Path - The temporary directory for the user currently logged in on the managed machine. This path is the expansion of the %TEMP% environment variable for the currently logged in user. If no user is logged in, it is the default Windows temporary directory.
    • Machine.Group ID - Machine ID of the agent executing the script.
    • File Version Number - Version number from the property of the specified file on the managed machine.
    • File Size - Size in bytes of the specified file on the managed machine.
    • File Last Modified Date - Date of the specified file on the managed machine in the format of yyyy/mm/dd hh:mm:ss.
    • SQL View Data - Use the GetVariable command with the SQL View Data option to create a new script variable and set it to the value of a dbo.SqlView.Column value. Use the format SqlViewName/ColumnName/mach.groupID or SqlViewName/ColumnName. If the optional machine ID is omitted, then the value for the agent executing the script is retrieved. If ColumnName contains a space, surround it with square brackets. Example: vSystemInfo/[Product Name]. See System > Database Views for a list of the SQL views and columns that are available.

      Note: - Automatic SQL View Data Variables - SQL view parameters are available as automatically declared script variables. Automatic variables enable you to skip using the GetVariable command with the SQL View Data option. Use the format #SqlViewName.ColumnName# in a script to return the value of a dbo.SqlView.Column for the agent executing the script.

    • WMI Property - A WMI namespace, class, and property. The format of the specified WMI property is NameSpace:Class.Property. For example, root\cimv2:Win32_OperatingSystem.FreePhysicalMemory.

Select Variable

Select a variable name from the drop-down list or select <New Variable> to create a new variable. Variable names are case sensitive.

Rename/Create Variable

Enter a new name for the new variable you are creating or for an existing variable you are renaming. Select the delete icon to delete the entire variable from all groups.

Public

Selecting the Public radio button allows the variable to be used by all administrators. However, only master administrators can create and edit shared variables.

Private

Selecting the Private radio button allows the variable to be used only by the administrator who created it.

Apply

Enter the initial value for a variable. Then select one or more Group IDs and click Apply. Empty values are not allowed.

Remove

Select one or more group IDs, then click Delete to remove the value for this variable from the group IDs it is assigned to.

Select All/Unselect All

Click the Select All link to check all rows on the page. Click the Unselect All link to uncheck all rows on the page.

Group ID

Displays all group IDs the logged in user is authorized to administer.

Value

Lists the value of the variable applied to the group ID.