2. Environment Variables in IWC
‒ You can set Environment Variables in your Workspace
Control session.
‒ Environment Variables can be set based on various
types of Access Control like Identity, Location and
Devices, Date and Time, Workspace Containers.
4. Environment Variables
‒ Set context based on Identity, Location and Devices,
Workspace Control, Connection State.
‒ ... can be used at other places in Workspace Control like
notifications, files and folders, messages, etc...
5. Order of Execution Workspace Control
‒ Environment variables
‒ Drive and port mappings
‒ Drive substitutes
‒ Printers
‒ User Registry Settings
‒ User Registry Policies
‒ User Home Directory actions
‒ User Profile Directory actions
‒ Folder synchronizations
‒ Execute Commands
‒ Automation tasks
‒ Linked actions
6. Order of execution Environment Variables
‒ Click on checkbox to change order of execution. Use
arrows to increase/decrease order.
7. IWC environment variables
Environment variable Description
%clientipadress% IP-adress of client. If server/workstation it will return the actual IP-adress. If RDS/XenApp
environment, it will return IP-adress of client. Example: 192.168.2.100
%clientname% Clientname. If server/workstation it will return the %computername%. If RDS/XenApp
environment, it will return name the client.
%deskpic% Filename of desktop wallpaper or logo. Example: CONTOSO_LOGO.JPG
%fullusername% Full username as entered in Active Directory displayname. Example: John doe
%lcid% Current Microsoft Locale ID. Example: 1033 (US English)
%pfappid% Application ID of current application. Example: 16
%rescustomresources% Filepath to RES-WM Custom Resources folder.
%reshomedrive% Drive letter of configured Workspace Control user home drive. See Files and Folders – User
Home Directory – Settings.
%respfdir% Filepath to Workspace Manager installation path.
Example: C:PROGRA~2RESSOF~1WORKSP~1
%resshell% Selected shell. MS = Windows shell, PF = legacy Workspace Manager Shell
%ressubprsnt% RES Subscriber present. Example: YES
%saverpic% Filename of screensaver image. Example: SCREENSAVER_CONTOSO.JPG
%usersid% User account security identifier. Example: S-1-5-21-1454471165-1004336348-1606980848-
5555
8. Windows built-in environment variables*
* Depends on Operating System version
Environment variable Description
%alluserprofile% Full path to common user profile folder. Example: C:ProgramData.
%appdata% Contains full path to application data for all users. This folder is used for application data that is
not user specific. Example: C:Users<username>AppDataRoaming
%computername% NETBIOS name of the workstation.
%homedrive% Drive letter which is mapped to the user home drive. Example: H:
%homepath%
%homeshare% Network UNC path of user home directory.
%localappdata%
%logonserver% Indicates which domain controller authenticated the client’s logon request
%os% Operating System. Will mostly show WIN_NT regardless of OS version.
%programdata% Full path to program data folder. Example: C:ProgramData
9. Windows built-in environment variables*
Environment variable Description
%programfiles% IP-adress of client. If server/workstation it will return the actual IP-adress. If RDS/XenApp
environment, it will return IP-adress of client. Example: 192.168.2.100
%programfiles(x86)%
%public%
%sessionname%
%systemdrive%
%systemroot%
%userdnsdomain%
%userdomain%
%username%
%userprofile%
%windir%
* Depends on Operating System version
10. Environment Variables Functions
‒ $adinfo(<property>)
Returns the value of a specific user property from AD. Example:
$adinfo(firstname).$adinfo(lastname)@%userdnsdomain% is often used to return
e-mail addresses.
Available properties: firstname, lastname, displayname, email, ouname, title, office,
department, phone, fax, company, street, pobox, city, state, postalcode, country,
webaddress, description, homedirectory, tshomedirectory.
‒ $usershellfolder(<folder>)
Returns the path to the specified Windows Explorer folder for the current user.
Example: $UserShellFolder(favorites) may return C:Documents and
Settings[USERNAME]Favorites.
Available user shell folders: appdata, desktop, favorites, nethood, personal,
printhood, programsmenu, recentfiles, sendto, startmenu, startupmenu, cache,
cookies, history, localappdata, mymusic, mypictures, myvideo, templates.
11. Environment Variables Functions
‒ $substring(%var%, start, length)
Returns a certain number of characters from the variable's value. Example:
$substring(%username%, 3, 4) takes 4 characters from the user name, starting with
the 3rd character. For the user name "Robert", the example would return the value
"bert".
‒ $uppercase(%var%) and $lowercase(%var%)
Convert the variable values to uppercase or lowercase. For example:
$uppercase(%username%) with the user name "RobertK" returns "ROBERTK", and
with $lowercase(%var%) it returns "robertk".
‒ $autocount(<minimumvalue>-<maximumvalue>)
Generates a number starting at the given minimum and increasing by 1 each time
a variable is set. When the given maximum is reached, the next time will start at
the given minimum again. For example, $autocount(5-10000) will start counting at
5 and go up to 10000; when 10000 is reached, the counter restarts at 5.
12. UserSettings variables
‒ Can only be used with UserSettings
‒ Cannot be used as environment variables
Environment
variable
Description
%nethood% Contains the link objects that may exist in the My
Network Places folder.
%personal% Stores a user's common repository of documents.
%printhood% Contains the link objects that can exist in the
Printers folder.
%programsmen
u%
Contains the user's program groups (which are
themselves file system directories).
%recentfiles% Contains shortcuts to the user's most recently used
documents.
%sendto% Contains Send To menu items.
%startmenu% Contains Start menu items.
%startupmenu
%
Corresponds to the user's Startup program group.
%templates% Common repository for document templates.
%userprofile% Contains the user profile
Environment
variable
Description
%appdata% Contains application data for all users. This folder is
used for application data that is not user specific.
%cache% Common repository for temporary Internet files.
%cookies% Common repository for Internet cookies
%desktop% Stores file objects on the desktop.
%favorites% Common repository for the user's favorite items.
%history% Common repository for Internet history items.
%localappdata% Data repository for local (non roaming)
applications.
%mymusic% Common repository for music files
%mypictures% Common repository for image files.
%myvideo% Common repository for video files.
13. Best Practices
‒ Environment variables are fast, flexible and easy to use. Use often
if applicable.
‒ Environment variables can be used in other IWC settings:
notifications, messages, files and folders, etc….
‒ Use Administrative note for your own
administration/documentation
‒ You can use environment variables in environment variables, like
%deskpic% = %customer%_%screenresolution%_%otap%.jpg
‒ Watch the order of execution when using environment variables in
environment variables.
14. Examples
‒ %fileserver%
Depending the physical location, the nearest file server will be set.
‒ %screenresolution%
Depending the screen resolution a value will be set which can be used with
%deskpic%, for example background_1920x1080.jpg.
‒ %DTAP%
Identifies Development, Test, Accepance or Production environment. Based on
Location and Devices.
‒ %msg_rdrives_%
Based on Language, the notification message for Removable Drive Security is set.