Share via

Variables in Preference Items

Applies To: Windows Server 2008

Preference extensions support Windows environment variables and generate a number of additional process environment variables. Any variable may be used in a configuration parameter value. Each Help document states whether variables are supported in a specific field.


Using Registry Match Targeting targeting items, you can define variables at client run-time, and have these control behavior using the Environment Variable Targeting targeting items or as values in a preference item setting.

Windows environment variables

The Windows environment is a list of variables saved as name/value pairs. To see the current list of variables, type SET at the command prompt. Each process, including the desktop, has a list of variables unique to the process. When one process launches another, normally a copy of the environment of the launching process is passed to the launched process. Typically, environment variable names are enclosed between two percent signs (for example, %ProgramFiles%). Windows resolves the environment variable when an application requests the value associated to the name.

Preference process variables

Preference extensions implement the process variables listed below.


Variables are not case sensitive.


The current user's Application Data directory.


The SID of the computer in hexadecimal format.


The SID of the current user in hexadecimal format. 


The "all users" Application Data directory.


The "all users" Desktop directory.


The "all users" Explorer Favorites directory.


The "all users" Programs directory.


The "all users" Start Menu directory.


The "all users" Startup directory.


The NetBIOS name of the computer.


The numeric identity of the main client process.


The numeric identity of the main client thread.


The current time (UTC).


The current time (UTC) with milliseconds.


The current user's desktop directory.


The domain name or workgroup of the computer.


The current user's Explorer Favorites directory.


The last error code encountered during configuration.


The last error code text description.


The SID of the computer in LDAP escaped binary format.


The SID of the current user in LDAP escaped binary format.


The current local time.


The current local time with milliseconds.


The domain of the current user.


The domain controller that authenticated the current user.


The user name of the current user.


The SID of the current user.


The first detected MAC address on the computer.


The current user's My Network Places directory.


The operating system: Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, or Unknown.


The Windows Program Files directory.


The current user's Programs directory.


The current user's Recent Documents directory.


The client's exit code.


The client's exit code text description.


The SID of the computer in reversed byte order hexadecimal format.


The SID of the current user in reversed byte order hexadecimal format.


The current user's Send to directory.


The current user's Start Menu directory.


The current user's Startup directory.


The Windows system directory.


The name of the drive from which the operation system is running.


The current user's Temp directory as determined by Windows API.


The time stamp of the configurations being executed.


The path/name of the trace file.


The Windows directory.

Preference extensions provide a list of variables from which you can choose to insert into text boxes. You can open the dialog box from any text box that is:

  • Not disabled.

  • Not read only.

  • Not restricted to a numeric value.

To enter a variable

  1. Open the Group Policy Management Console. Right-click the Group Policy object (GPO) that contains the preference item you want to configure, and then click Edit.

  2. Place the cursor in the desired box.

    • To enter a preference process variable, press F3, select a variable from the list, and then click Select to insert the variable in the box.

    • To enter an existing Windows environment variable, type the variable in the box.


You can prevent the resolution of a variable before it is applied to client computers (so that the variable rather than the resolved value appears in the preference setting on client computers). To do so for a preference process variable, clear the Resolve Variable check box. This inserts <> between the %% delimiters and the variable name (for example, %<ProgramFiles>%). Preference extensions remove < > characters from the text and leave the unresolved variable. You can also use this syntax with a Windows environment variable.

Additional references