Next Topic

Previous Topic

Book Contents

Using Variables

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

  • Two Methods for Creating Variables:
    • Procedure Variables - Use the Get Variable command within a procedure to create a new variable name without any special characters. Example: VariableName. In subsequent steps, including steps in nested procedures, reference the variable by bracketing the variable name with the # character. Example: #VariableName#. Procedures variables cannot be referenced outside of the procedure or nested procedures that use them.
    • Managed Variables - Use the Variable Manager to define variables that can be used repeatedly in different procedures. 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 procedure. Within a procedure, 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-ELSE-STEP 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 procedure 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 procedure editor.
    • 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 Working Directory Path - Working directory on the managed machine as specified using Agent > Working Directory.

      Warning: Do not delete files and folders in the working directory. The agent uses the data stored in the working directory to perform various tasks.

    • User Temporary Directory Path - The temporary directory for the user currently logged on the managed machine. This path is the expansion of the %TEMP% environment variable for the currently logged on user. If no user is logged on, it is the default Windows temporary directory.
    • Machine.Group ID - Machine ID of the agent executing the procedure.
    • File Version Number - The software version number of the specified file on the managed machine. For example, an exe or dll file often contain the version number of their release.
    • File Size - Size in bytes of the specified file on the managed machine.
    • File Last Modified Date - The last modified date and time in universal time, coordinated (UTC) 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 procedure 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 procedure 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 procedure variables. Automatic variables enable you to skip using the GetVariable command with the SQL View Data option. Use the format #SqlViewName.ColumnName# in a procedure to return the value of a dbo.SqlView.Column for the agent executing the procedure.

    • 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. Specify an instance using the following syntax: NameSpace:Class[N].Property where [N] is the instance number. For example, root\cimv2:Win32_OnboardDevice[3].Description. The first instance may be specified with or without specifying the [1] instance number.
    • Expression Value - Specify an expression that consists of procedure variables and six mathematical operators +, -, *, /, (, and ) that are evaluated and assigned to a new procedure variable. For example, ((#variable1# + #variable2#) + 17.4) / (#variable3# * 4). The procedure variables must contain numeric values.
    • 64-Bit Registry Value - Data from the specified registry value on the managed machine.
    • Prompt when procedure is scheduled - Displays a message prompt to enter a value when an agent procedure is run. The value is stored in the variable name you specify. Specify the prompt text and variable name. For example, each time this procedure is run, a VSA user could enter a different machine directory.