maandag 11 mei 2009 11:15
Kurt Roggen
Group Policy Preferences: Tips & Tricks #1: Variables List
In many cases, when you are in the Group Policy Preferences editor, you can use the F3 function key and use Variables List to select a variable from.
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.
F3 function key to use Variables List |
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.
This variables list contains 2 types of variables:
- Windows environment variables: Variables defined externally to GPP
Default system and/or user variables or custom-defined by user or administrator and visible using SET command.
Some examples: %USERNAME%, %USERDOMAIN%, %COMPUTERNAME%, %HOMEPATH%, %HOMEDRIVE%, %USERNAME%, %LOGONSERVER%, %OS%, etc…
- Preference Process Variables: Variables defined internally to GPP
Variables known only to Group Policy Preferences extensions.
Some examples: %GROUPPOLICYVERSION%, %DATETIME%, %MACADDRESS%, %OSVERSION%, %LOGONSERVERSID%
For a more complete list, see below.
| Variables List %AppDataDir% - The current user's Application Data directory. %BinaryComputerSid% - The SID of the computer in hexadecimal format. %BinaryUserSid% - The SID of the current user in hexadecimal format. %CommonAppdataDir% - The "all users" Application Data directory. %CommonDesktopDir% - The "all users" Desktop directory. %CommonFavoritesDir% - The "all users" Explorer Favorites directory. %CommonProgramsDir% - The "all users" Programs directory. %CommonStartMenuDir% - The "all users" Start Menu directory. %CommonStartUpDir% - The "all users" Startup directory. %ComputerName% - The NetBIOS name of the computer. %CurrentProcessId% - The numeric identity of the main client process. %CurrentThreadId% - The numeric identity of the main client thread. %DateTime% - The current time (UTC). %DateTimeEx% - The current time (UTC) with milliseconds. %DesktopDir% - The current user's desktop directory. %DomainName% - The domain name or workgroup of the computer. %FavoritesDir% - The current user's Explorer Favorites directory. %LastError% - The last error code encountered during configuration. %LastErrorText% - The last error code text description. %LdapComputerSid% - The SID of the computer in LDAP escaped binary format. %LdapUserSid% - The SID of the current user in LDAP escaped binary format. %LocalTime% - The current local time. %LocalTimeEx% - The current local time with milliseconds. %LogonDomain% - The domain of the current user. %LogonServer% - The domain controller that authenticated the current user. %LogonUser% - The user name of the current user. %LogonUserSid% - The SID of the current user. %MacAddress% - The first detected MAC address on the computer. %NetPlacesDir% - The current user's My Network Places directory. %OsVersion% - The operating system: Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, or Unknown. %ProgramFilesDir% - The Windows Program Files directory. %ProgramsDir% - The current user's Programs directory. %RecentDocumentsDir% - The current user's Recent Documents directory. %ResultCode% - The client's exit code. %ResultText% - The client's exit code text description. %ReversedComputerSid% - The SID of the computer in reversed byte order hexadecimal format. %ReversedUserSid% - The SID of the current user in reversed byte order hexadecimal format. %SendToDir% - The current user's Send to directory. %StartMenuDir% - The current user's Start Menu directory. %StartUpDir% - The current user's Startup directory. %SystemDir% - The Windows system directory. %SystemDrive% - The name of the drive from which the operation system is running. %TempDir% - The current user's Temp directory as determined by Windows API. %TimeStamp% - The time stamp of the configurations being executed. %TraceFile% - The path/name of the trace file. %WindowsDir% - The Windows directory. |
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.
Related reading:
Filed under: GroupPolicies, GroupPolicyPreferences