Environment Manager

Home 

This page refers to an older version of the product.
View the current version of the User Help.

Environment Actions

Environment actions enable both Environment Variables and Session Variables to be configured on managed endpoints. When triggered, both types of variables can be set or deleted whilst Environment Variables can also be appended.

In this section:

Environment Variables

There are two common types of environment variables – user environment and system environment variables. User environment variables are set on the User triggers in Environment Manager, and system environment variables on Computer triggers.

Environment variables set in actions are available to all child actions or triggers and on any future triggers. Variables are also available to other applications, such as Windows Explorer, but only after the trigger containing the action completes.

  • User environment variables typically store information related to resources and settings owned by the user.

    Examples of user environment variables include %TEMP% which points to a specific user’s folder for storing temporary files or %HOMEPATH% which points to a user’s profile directory.

  • System environment variables typically refer to locations of critical operating system resources or architecture.

    Examples of system environment variables include %windir% which is the path to the Windows directory or %ProgramFiles% which points to the location of the Program Files directory

Session Variables

Session variables provide an alternative to environment variables, allowing data to be passed through an Environment Manager configuration without the limitations on lifetime and scope that apply to environment variables - session variables extend across multiple processes for a given user and session.

Session variables can be used and expanded anywhere within Environment Manager where environment variables can be used. They can be used for applying bespoke file paths for map drive and folder redirection actions and are particularly useful when used in the scripts within Custom actions and conditions.

Environment Variable and Session Variable Actions

Set Environment Variable

Enter the Variable Name and Variable Value.

A list of existing environment variables available on the computer on which the Environment Manager Console is running is displayed. These can be selected and their variable values edited as required.

The Environment Variable is set on managed endpoints with the value as entered.

Append Environment Variable

Enter the Variable Name, Variable Value to be appended and select the Separator to be used between the existing Variables and Append values. The selected environment variable is updated to include the append value using the entered separator.

A list of existing environment variables available on the computer on which the Environment Manager Console is running is displayed. These can be selected and appended to by entering the Variable Value to be appended and the Separator.

For example, you could append the PATH Environment Variable with a new location, specifying the separator as a semi-colon.

Delete Environment Variable

Enter the Variable Name to be deleted from managed endpoints.

A list of existing environment variables available on the computer on which the Environment Manager console is running is displayed. These can be selected for deletion.

Set Session Variable

Enter the VariableName and VariableValue to be used within the Environment Manager configuration.

The Session variable is set on managed endpoints with the value as entered.

Delete Session Variable

Enter the Session VariableName to be deleted from use within the Environment Manager configuration.

Session Variable Format

Session variables are case insensitive and are referenced by enclosing round brackets and a preceding $. For example:

$(SessionVariable)

Incorrectly formatted session variables do not expand. The table below gives some examples of successful and unsuccessful expansions.

In these examples, the variable ’valid_variable’ has been set to ’SessionVariableValue’.

Reference Expansion
$(valid_variable) SessionVariableValue
$(variable_does_not_exist) $(variable_does_not_exist)
$() $()
$no_brackets_defined $no_brackets_defined
$(missing_closing_bracket $(missing_closing_bracket
$missing_opening_bracket) $missing_opening_bracket)
$(valid_variable) $(Valid_Variable) $(vALID_vARIABLE) $(VALID_VARIABLE) SessionVariableValue
$(valid_variable$(valid_variable)) $(valid_variable$(valid_variable))
$(valid_variable)) SessionVariableValue)
$((valid_variable) $((valid_variable)

Default Session Variables

Environment Manager includes three in-built session variables:

  • SessionID - The current Session ID
  • UserSID - The user’s Security Identifier
  • UserTemp - The location of user’s Temporary Directory

These can used in actions and conditions and in particular, can be quickly added to custom scripts using the Insert function.

Session Variable Examples

Using Session Variables in Policy Actions

In the example below a session variable is used to map a drive when users open Word. The session variable is set at logon and is dependent on their Active Directory Organizational Unit (OU) membership.

An If Else condition, run at logon, checks the OU of a user and sets a UserGroup session variable relative to that group. For example, if the user is a member of Sales, UserGroup session variable is set to ’sales’.

Session Variable Example 1

A Map Drive action runs when a user opens Word mapping a drive to the following location:

\\Docs\$(UserGroup)

The $(UserGroup) expands to the value set at logon. For example, if the user is a member of Sales, the session variable will expand mapping the drive to:

\\Docs\Sales

Session Variable Example 2

Using Session Variables in Custom Actions

This example demonstrates how session variables can be used in scripts with Environment Manager custom actions.

Two actions have been added to the Logon > Pre-Desktop trigger - one which sets two session variables and the other which maps a drive using those variables.

Session Variable example 3

Custom Action

The following script in a Custom action obtains the user name from the environment and sets two session variables - $(first_letter) and $(first_two_letters).

$user = $env:USERNAME

if ($user.Length -gt 1)

{

 $first_letter = $user[0]

 $first_obj = New-Object -ComObject "EmClient.SetValue"

 $first_obj.Name = "first_letter"

 $first_obj.Value = $first_letter

 $first_obj.Apply("")

 

 $first_two_letters = $user[0] + $user[1]

 $second_obj = New-Object -ComObject "EmClient.SetValue"

 $second_obj.Name = "first_two_letters"

 $second_obj.Value = $first_two_letters

 $second_obj.Apply("")

}

Map File Action

The session variables set in the Custom action are used in the Map Drive action to map a drive for each managed user:

%SYSTEMDRIVE%\%SESSIONNAME%\$(first_letter)\$(first_two_letters)\Home

Related Topics


This page refers to an older version of the product.
View the current version of the User Help.