User-Defined Variables

When using user-defined tasks in the DSMC, you can employ user-defined variables to pass execution parameters to the user-defined tasks. User-defined variables can be grouped in variable groups.In the variable group's properties you can specify for which type of objects (computer, mobile devices, software, virtual environments) the variables will appear.

Use Cases

User-defined variables can be employed, for example,

  • to store the user name and password for the automatic logon to a computer,
  • to store the path to a script that will be executed with a user-defined task,
  • to process the variables when executing software packages.

Types

There are different types of user-defined variables. Some variables come with the DSM environment. Being system objects, these system variables are a special type of user-defined variables. You cannot change nor delete them but you can copy them.

User-defined variables have the following properties:

  • ID
    System-wide unique ID as database key
  • Variable Tag
    Unique internal variable name within the same variable group (e.g. UserName, referenced as Var.UserCredentials.UserName)
    The following characters are permitted: Aa-Zz, 0-9, underscore.
  • Display Name
    Displayed name of the variable (e.g. user name) (localizable).
  • Description
    Description of the variable (localizable).
  • Display Order
    Order in which the variables are displayed if several variables have been defined for one leaf object.By default, all variables get the value 100 and they are displayed in the order they were created.
  • Is available on client (Boolean)
    The variable is available on managed computers and can thus also be used in software packages.
  • Is disabled (Boolean)
    The variable is disabled.
  • Type of variable
    Specifies the type of the variable. For option list variables there is an additional Property List for the definition of the options available.

Rights and Roles

To employ user-defined variables, please log on to the DSMC with a role that owns the following rights:

  • Assign variable
  • Manage variables

Please refer to the topic Available Rights for further information on these rights.

Variable Grouping

Variables are included in variable groups. A variable can be and must be member of exactly one variable group. Variables can be moved between variable groups. Variable groups cannot be nested.

A variable group has the following properties:

  • ID
    System-wide unique ID as database key
  • Variable Group Tag
    System-wide unique internal name of the variable group (e.g. UserCredentials).
  • Display Name
    Displayed name of the variable group (e.g. user credentials) (localizable).
  • Description
    Description of the variable group (localizable).
  • Display Order
    Order in which the variables are displayed if several variables have been defined for one leaf object. By default, all variables get the value 100 and they are displayed in the order they were created.
  • Visibility
    Area in the DSMC, where you want to display the variable group and its variables (ComputersUsers, Software, Virtual Environments, Mobile Devices).

Variable Definition

User-defined variables have to be defined before they can be used the first time. Variables are defined in the Organization Tree, by opening the ORG object's context menu and selecting the task Manage Variables.

Assignment of Variable Values

Variable values can be assigned for the following objects of the DSM organization tree:

  • Leaf objects such as computers, users, etc.
    Note that you can only set values for variables that actually appear in the respective context. When you define the respective variable you can also define where it will appear.
  • Static, dynamic and external groups
  • Organizational units (OUs)

The variable values are displayed in the DSMC in

  • grayed out characters:
    If the variable has not been defined, does not have a value assigned to it and has not been inherited from a parent organization tree object it is displayed grayed out.
  • normal characters:
    If the variable value has been inherited from a parent object it is displayed normally.
  • semi-bold characters:
    If the variable value has been set for the specific object it is displayed semi-bold.

An undefined or inherited variable value can be overwritten directly. A variable value specified directly for the object can be reset (this makes the variable undefined).

Variables and variable values can be displayed, changed and deleted on the Variables tab. Variables and variable values are displayed as soon as you select a DSM organization tree object in the DSMC.

Determination of the Effective Variable Value

The same variable can take different values on different levels of the DSM organization tree; therefore, the values of the variable may be assigned multiply and accumulate on "simple" leaf objects (computers, users). This conflict can be solved with the same algorithms that are applied when policies accumulate on individual objects. Apart from a generic general algorithm, several special algorithms are used as well.

The following lists provide information on the valence of the assigned variable values.The valence decreases from top to bottom. The result is the effective variable value.

The effective variable value is searched in a defined sequence. The search is terminated as soon as a value can be determined:

  1. The variable value was set for a leaf object.
  2. The variable value was set for a static group where the leaf object is a member.
  3. The variable value was set for an external group where the leaf object is member.
  4. The variable value was set for a dynamic group where the leaf object is member.
  5. The variable value was set for a parent object of the leaf object.

If the leaf object is a member of several similar groups, where the variable has a different value in each group, the value of the first group will be used as effective variable value after sorting in alphabetical order.

In the following two cases the system uses a special algorithm to determine the effective variable value:

  • When determining the access data required to log on to a host for virtual machines
  • When determining the name of a Citrix farm

The special process of resolving variables requires a specific variable prefix for referencing (see the next section "Referencing Variables").

Referencing Variables

A variable must be referenced with its Fully Qualified Name in user-defined tasks or eScripts. The format has the same known notation as the other DSM variables (%X.Y.Z%) and denotes the object and the type of variable, separated by a dot.

Objects

  • CurrentComputer
  • CurrentUser
  • CurrentPackage

Types of Variables

  • .Var (valid for CurrentComputer, CurrentUser, CurrentPackage):
    System variables (property IsSystem) have the prefix System in the name of the variable group. User-defined variable groups cannot have this prefix.
  • .AssocHost (valid for CurrentComputer):
    First associated host for virtual machines for CurrentComputer
  • .Parent (valid for CurrentComputer, CurrentUser, CurrentPackage):
    Parent object of the current object
  • .[NameOfPropGroup] (valid for CurrentComputer, CurrentUser, CurrentPackage):
    Name of a property group of the object
  • .Object (allowed for CurrentComputer, CurrentUser, CurrentPackage):
    Basic properties of the object

Examples

  • The current object in the following examples may be a selected object in the DSMC or a computer or user with the client synchronization.
  • Reference the properties of the current object:
    %CurrentComputer.Object.BasicInventory.LastSyncAgent%
  • Reference the system variable Var1 in the variable group CoolVars of the current computer:
    %CurrentComputer.Var.SystemCoolVars.Var1%
  • Reference the user-defined variable Var1 in the variable group CoolVars of the current object:
    %CurrentComputer.Var.CoolVars.Var1%
  • Reference the basic property of the parent container object. The basic property group will be used because there is no property group specified:
    %CurrentComputer.Object.Parent.Id%
  • Reference the system variable UserNamein the variable group Credentials of a host for virtual computers:
    %CurrentComputer.AssocHost.Var.SystemCredentials.UserName%
  • Reference the properties of the host for virtual computers:
    %CurrentComputer.AssocHost.Object.VMHost.URL%
  • Navigation (e.g. with a catalog link or ObjectLink) is supported:
    %CurrentComputer.BasicInventory.InstalledOS.Object.Name%