012 A Introduction
012 A Introduction
Administrators can use Group Policy to deliver and apply one or more
desired configurations or policy settings to a set of targeted users and
computers within an Active Directory® directory service environment.
The majority of available policy settings are provided through
Administrative Template files (.adm files) and are designed to modify
specific keys in the registry. This is known as registry-based policy. For
many applications, the use of registry-based policy delivered by .adm
files is the simplest and best way to support centralized management
of policy settings.
.Adm files are UNICODE text files that Group Policy uses to describe
where registry-based policy settings are stored in the registry. All
registry-based policy settings appear and are configured in the Group
Policy Object Editor under the Administrative Templates node. .Adm
files do not apply policy settings; they simply enable administrators to
view the policy settings in the Group Policy Object Editor.
Administrators can then create Group Policy objects (GPOs) containing
the policy settings that they want to use. For example, you might have
one GPO that contains various policy settings for managing the Active
Desktop feature.
• The Group Policy Object Editor reads the .adm files. By default,
when an administrator opens a GPO, a comparison is made
between the timestamps of the .adm files stored in the GPO
being edited and those on the local computer. If the local .adm
files have a more recent timestamp then they are uploaded to
the domain controller and replicated throughout the domain.
• The Group Policy Object Editor console (gpedit.msc) displays the
settings, and, depending on the .adm file, the policy settings can
be displayed in a localized language.
• The Group Policy Object Editor uses .adm files to configure user
interface settings such as dialog boxes, radio buttons, and drop-
down lists, thereby enabling administrators to manage these
settings centrally.
• The Group Policy Management Console (GPMC) uses .adm files to
display policy settings when using Group Policy Results or Group
Policy Modeling, also known as Resultant Set of Policy (RSoP).
Note
The Group Policy Object Editor displays the policy settings within the
.adm files that are included with the operating system by default.
These .adm files are:
Most Group Policy settings are contained in the System.adm file. The
.adm files that ship with Windows Server 2003, Windows XP
Professional, and Windows 2000 Server operating systems are located
in the %windir%\inf\ folder. (for example, C:\Windows\inf). For more
information about .adm file maintenance, see the "Maintaining and
Managing .Adm Files" in this document.
Group Policy settings that administrators can fully manage are known
as "true policies." In contrast, settings that users configure or that
reflect the default state of the operating system at installation time are
known as "preferences." Both true policies and preferences contain
information that modifies the registry on users' computers. True policy
settings take precedence over preference settings.
Registry values for true policies are stored under the approved registry
keys as listed in Table 1. Users cannot change or disable these
settings.
Table 2 lists the resultant behavior for Group Policy settings and
preferences.
Policy Preference
Scenario Present Present Resultant Behavior
Use the following questions as a guide to help you design Group Policy
settings.
• What is the default behavior (that is, when the policy is set to
Not Configured)?
• What is the behavior when the policy is Enabled, Disabled, or
Not Configured? The Enabled behavior should always be the
opposite of the default behavior (that is, Not Configured).
• Do administrators need to explicitly disable a feature?
• Do the proposed policy settings affect users or computers or
both?
• What are some potential future ramifications of the new policy
settings? When new products are released, you must continue to
maintain the previous .adm settings to manage computers
running legacy software. New products and settings must be
able to co-exist with earlier versions.
Policy Names
You set the name of the policy setting at the same time that you
create it. The name of the policy setting is displayed in the Group
Policy Object Editor. Use the following guidelines for creating policy
names:
• Use a verb that reflects the effect of the policy setting. Examples
of verbs commonly used in policy setting names include: allow,
permit, turn on, prohibit, hide, and prevent.
• Do not use the terms "enabled" or "disabled" in your policy
setting names. Instead, consider using the terms "turn on" and
"turn off," or "allow" and "prevent."
• Avoid overly technical jargon that might not be understood by
administrators who are not experts in a particular component.
Include technical details of the policy setting in the Explain text.
• Use short, descriptive names that accurately reflect the function
of the policy setting, for example, Turn off Internet File
Association service.
Note
Note
Use the following template for the Explain text, and make sure that
you include the following items:
This setting lets you specify the wallpaper on users' desktops and
prevents users from changing the image or its presentation. The
wallpaper you specify can be stored in a bitmap (*.bmp), JPEG (*.jpg),
or HTML (*.htm, *.html) file.
To use this setting, type the fully qualified path and name of the file
that stores the wallpaper image. You can type a local path, such as
C:\Windows\web\wallpaper\home.jpg or a UNC path, such as
\\Server\Share\Corp.jpg. If the specified file is not available when the
user logs on, no wallpaper is displayed. Users cannot specify
alternative wallpaper. You can also use this setting to specify that the
wallpaper image be centered, tiled, or stretched. Users cannot change
this specification.
Also, see the "Allow only bitmapped wallpaper" in the same location,
and the "Prevent changing wallpaper" setting in User
Configuration\Administrative Templates\Control Panel.
Note
Note
This setting does not apply to Terminal Server sessions.
All policy settings should have an associated behavior for each of the
three possible states shown in Table 3:
• Policy settings are never removed from the .adm files supplied
by Windows operating systems. Even if subsequent versions of
Windows no longer support the policy setting, Microsoft will
continue to include that policy setting in .adm files for all future
Windows operating systems that support Group Policy.
• Computer policy settings should override user policy settings.
• The Enabled behavior should be the opposite of the default
behavior. For example, if a feature is on by default, the policy
setting should be named using something like "Turn off
<feature>", for example, Turn off reminder balloons. By
default, reminder balloons are displayed when the Offline Files
feature is enabled; they are used to notify users when they have
lost the connection to a networked file and are working on a local
copy of the file. If Turn off reminder balloons is set to
Enabled, the system hides the reminder balloons, and prevents
users from displaying them.
• Consider whether administrators need to explicitly disable a
feature. You must understand the differences between the Not
Configured state (which implies that the administrator does not
care) and the Disabled state (which means that the
administrator cares and wants to implement a very specific
behavior).
• Make sure that your documentation team is involved with
creating the Explain text. Well-written Explain text can help
reduce support calls.
• Each component should expose a user interface that always
reflects the policy setting that is applied. For example, if a Group
Policy setting removes the ability for the user to set a preference
for a component, the user interface should clearly indicate this
and access to that particular item in the component should be
removed (for example, the item is disabled and grayed-out, or it
is not visible to users).
You can create custom .adm files to extend the use of registry-based
policy settings to new applications and components. Creating and
implementing custom .adm files involves the following tasks:
Caution
Treat the .adm files that ship in the operating system as read-only
files. These files are often updated when you install service packs or
future releases of the product. Policy settings should never be
removed from .adm files that are included in the operating system by
default.
Keep in mind that by itself, the .adm file does not actually apply Group
Policy to the client computer. You must have a corresponding
component or application that responds to the registry key that is
affected by the policy setting.
Copy Code
CLASS USER
CATEGORY !!DesktopLockDown
POLICY !!DisableTaskMgr
EXPLAIN !!DisableTaskMgr_Explain
VALUENAME "DisableTaskMgr"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
KEYNAME "Software\Policies\System"
END POLICY
END CATEGORY
[strings]
DisableTaskMgr="Disable Task Manager"
DisableTaskMgr_Explain="Prevents users from starting Task Manager"
DesktopLockDown="Desktop Settings"
This sample code exists in the System.adm file. It allows you to
configure a policy called Disable Task Manager, which appears in
the Group Policy Object Editor namespace in User
Configuration\Administrative Templates\Desktop Settings.
Selecting this option updates and reapplies the policy settings even if
you -- the Group Policy administrator -- have not changed the policy
settings. This provides an additional safeguard in the event that local
administrators try to change policy settings through the registry. Policy
settings are reapplied during the regular background refresh of Group
Policy, which occurs by default every 90 minutes with a randomized
delay of up to 30 minutes.
This section shows you how to create a simple .adm file for delivering
registry-based Group Policy settings. The code samples provided are
parts of a single .adm file. Please refer to "Language Reference for
Administrative Template Files," later in this document for full details
about the .adm language.
The sections of the sample .adm file illustrate how to set a registry
value to:
Copy Code
CLASS USER
CATEGORY!!SampleCategory
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Samples"
POLICY!!Sample_ADM_FeatureOnOff
#if version >= 4
SUPPORTED!!SUPPORTED_WindowsXPSP1
#endif
EXPLAIN!!Sample_ADM_FeatureOnOff_Help
VALUENAME "ADM_Sample_FeatureOnOff"
VALUEON 1
VALUEOFF 0
END POLICY
END CATEGORY
Copy Code
POLICY!!Sample_ADM_DropDownList
#if version >= 4
SUPPORTED!!SUPPORTED_WindowsXPSP1
#endif
EXPLAIN!!Sample_ADM_DropDownList_Help
PART!!Sample_ADM_DropDownList DROPDOWNLIST REQUIRED
VALUENAME "Sample_ADM_DropDownList"
ITEMLIST
NAME !!Sample_ADM_DropDownList_Always VALUE NUMERIC
1 DEFAULT
NAME !!Sample_ADM_DropDownList_WorkStationOnly VALUE
NUMERIC 2
NAME !!Sample_ADM_DropDownList_ServerOnly VALUE NUM
ERIC 3
END ITEMLIST
END PART
END POLICY
You can use registry-based Group Policy to display a list box that
contains Add and Remove buttons.
By default, only one column appears in the list box, and for each entry,
a value is created where the name and value are the same. For
example, a name entry in the list box creates a value called name that
contains data labeled name.
Copy Code
POLICY!!Sample_ADM_ListBox
#if version >= 4
SUPPORTED !!SUPPORTED_WindowsXPSP1
#endif
EXPLAIN!!Sample_ADM_ListBox_Help
PART!!Sample_ADM_DropDownList LISTBOX
KEYNAME "Sample_ADM_ListBox"
END PART
END POLICY
This setting allows the user to type alphanumeric text in an edit field.
The text is set in the registry with the REG_SZ type.
Copy Code
POLICY!!Sample_ADM_EditText
#if version >= 4
SUPPORTED !!SUPPORTED_WindowsXPSP1
#endif
EXPLAIN!!Sample_ADM_EditText_Help
PART!!Sample_ADM_EditText EDITTEXT
VALUENAME "ADM_Sample_EditText"
END PART
END POLICY
Copy Code
POLICY!!Sample_ADM_Numeric
#endif
EXPLAIN!!Sample_ADM_Numeric_Help
PART!!Sample_ADM_Numeric NUMERIC
VALUENAME "ADM_Sample_Numeric"
END PART
END POLICY
Copy Code
POLICY!!Sample_ADM_Spinner
#if version >= 4
SUPPORTED !!SUPPORTED_WindowsXPSP1
#endif
EXPLAIN!!Sample_ADM_Spinner_Help
PART!!Sample_ADM_Spinner NUMERIC
VALUENAME "ADM_Sample_Spinner"
MIN 5 MAX 23 DEFAULT 14 SPIN 3
END PART
END POLICY
Copy Code
POLICY!!Sample_ADM_ActionList
#if version >= 4
SUPPORTED !!SUPPORTED_WindowsXPSP1
#endif
EXPLAIN!!Sample_ADM_ActionList_Help
ACTIONLISTON
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Sample\ActionOnLis
t"
VALUENAME "Action1"
VALUE NUMERIC 1
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Sample\ActionOnLis
t"
VALUENAME "Action2"
VALUE NUMERIC 7
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Sample\ActionOnLis
t"
VALUENAME "Action1"
VALUE NUMERIC 100
END ACTIONLISTON
ACTIONLISTOFF
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Sample\ActionOnLis
t"
VALUENAME "Action1"
VALUE NUMERIC 0
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Sample\ActionOnLis
t"
VALUENAME "Action2"
VALUE NUMERIC 0
KEYNAME "SOFTWARE\Policies\Microsoft\ADM_Sample\ActionOnLis
t"
VALUENAME "Action1"
VALUE NUMERIC 0
END ACTIONLISTOFF
END POLICY
First, test your new policy settings individually. Next, test how each
policy setting interacts with other policy settings that are similar, or
policy settings that are also designed to manage the affected
component.
Suppose for example that you create a policy setting to configure the
wallpaper that is displayed on your clients' desktops. The list of policy
settings that ship with Windows Server 2003 includes other wallpaper
policy settings. In this scenario, you should test how these policy
settings interact. Any issues that arise should be addressed or
documented in the Explain text.
To simplify testing, create a sample .adm file for your policy setting. By
doing this step, you can isolate testing of the new policy settings until
they are ready to be merged into a larger .adm file, if appropriate.
• System.adm
• Conf.adm
• Inetres.adm
• Wmplayer.adm
• Wuau.adm
Note
If you create a GPO and do not edit it, you will create a Group Policy
template without any associated .adm files.
By default, when you edit GPOs, the Group Policy Object Editor
compares the timestamps of the .adm files in the workstation's
%windir%\Inf folder (local .adm files) with those that are stored in the
Sysvol (these are the .adm files used by the GPO that is being edited).
If the local .adm files are newer, the Group Policy Object Editor copies
these files to the Sysvol, overwriting any existing files of the same
name. This comparison occurs whenever the Administrative Templates
node (under Computer or User Configuration) is selected in the Group
Policy Object Editor, regardless of whether the administrator actually
edits the GPO.
Caution
An error can occur when the existing and the added .adm file contain
the same CATEGORY, and both of them have a default KEYNAME
specified (regardless of whether it is the same name). If these
conditions are met, the following error message appears.
Key name specified more than once. Likely causes are: 1) the
KEYNAME tag is defined multiple times in this category, 2) this
KEYNAME is already defined in another category with the same name,
3) this KEYNAME is already defined in another category with the same
name in a different .adm file.
By default, the first time the Group Policy Object Editor is started for a
specified GPO, it copies the System.adm file from the current
computer's %windir%\inf\ directory to the GPO.
Subsequently, only those .adm files specified in the list are displayed.
Each time you open Group Policy Object Editor, the Group Policy Object
Editor also checks the listed .adm files and copies any newer versions
from the local computer's %windir%\inf\ directory to the GPO.
By default, GPMC always uses local .adm files, regardless of their time
stamp, and it never copies .adm files to Sysvol. If an .adm file is not
found locally, GPMC looks for the .adm file in the Sysvol. In GPMC, you
can specify an alternative location for .adm files. If an alternative
location is specified, this alternative location takes precedence.
Because .adm files are stored in the Group Policy template by default,
they increase the Sysvol folder size. The File Replication Service (FRS)
replicates all of the .adm files for GPOs throughout the domain. If you
edit GPOs frequently, you might experience a significant amount of
replication traffic. You can use a combination of the Turn off
automatic updates of adm files and Always use local adm files
for Group Policy Object Editor policy settings to reduce the size of
the Sysvol folder and policy-related replication traffic.
Note
In Windows 2000 operating systems, when you edit a GPO for the
first time the local .adm files are uploaded to the Sysvol, without
regard to how this policy setting is set. If this policy setting is enabled
in Windows XP, .adm files are not uploaded when a GPO is edited for
the first time. The first time that the GPO is edited might or might not
be when the GPO is created.
Always Use Local .Adm Files for Group Policy Object Editor
The Always use local ADM files for Group Policy Object Editor
policy setting is available under Computer
Configuration\Administrative Templates\System\Group Policy in
Windows Server 2003 and Windows XP Professional. When a GPO is
created, this policy setting has no immediate effect, and the .adm files
on the local computer are still uploaded to the Sysvol. However, when
you edit an existing GPO, any .adm files that are stored in the Sysvol
are ignored, and Group Policy Object Editor uses the .adm files from
the local computer only. If a policy setting has been set in the GPO, but
the corresponding .adm file that describes the policy setting is not
available on the local computer, Group Policy Object Editor does not
display that policy setting.
Note
Note
For Windows 2000 operating systems, the use of local .adm files for
the Group Policy Object Editor is not supported. If you are using
Windows 2000, use the Turn off automatic updates of adm files
policy setting. Because this policy setting has no effect on the creation
of new GPOs, the local .adm files will be uploaded to the GPT folder in
Windows 2000. Creating a GPO in Windows 2000 effectively defines
the language of the GPO. If the Turn off automatic updates of adm
files policy setting is in effect on all computers running Windows 2000,
the language of the adm files in the GPT folder will be defined by the
language of the computer that is used to create the GPO.
If you are using Windows 2000 workstations, use the Turn off
automatic updates of adm files policy setting for administrators,
and consider the adm files in the GPT folder to be the effective
language for all Windows 2000 workstations.
Note
The Always use local adm files for Group Policy Object Editor policy is
typically used with the Turn off automatic updates of adm files policy
setting, (that is, when it is supported by the operating system from
which you are running Group Policy Object Editor).
Keyboard Shortcuts for Administrative Templates Node
You can use the following keyboard shortcuts to navigate the
Administrative Templates namespace:
When the Properties page appears, move it out from in front of the
Group Policy Object Editor window. Then, click back one of the
Policies in the results pane. You can now use the cursor keys to
navigate up and down the list. Notice that the information in the
Properties page changes. This method also works for the text on the
Explain tab. You can also use the Tab key to move back and forth
between the tree pane and the results pane, while leaving the
Properties page open.
Without the additive keyword, only the values D, E, and F in GPO y are
applied to the registry of targeted computers. This is because GPO y is
the last GPO applied. With the additive keyword, all of the values from
both GPOs are applied: A, B, C, D, E, and F.
Because, the disabled functionality only works when using the latest
version of the gptext.dll, all policy settings that use LISTBOX ADDITIVE
are enclosed by the #if version > 5 ...#end if construct. This eliminates
the possibility of having multiple administrators experiencing different
disabled behavior if they are using earlier versions of gptext.dll.
Consequently, the policy settings that use LISTBOX ADDITIVE are not
visible when editing a GPO from a computer running Windows
Server 2003, Windows XP with SP1, or Windows 2000 operating
systems.
The .adm files that use the LISTBOX ADDITIVE syntax do not fully load
on earlier versions of the Group Policy Object Editor (gpedit), which is
present by default in Windows Server 2003, Windows XP with SP1, and
Windows 2000. If attempted, multiple error messages will appear when
the system.adm and inetres.adm files are loaded in earlier versions of
gpedit.
The error message is "The following entry in the [strings] section is too
long and has been truncated." This occurs because earlier versions of
gpedit cannot correctly handle the "#if version >= 5 / #endif"
construct in the inetres.adm and system.adm files. Although clicking
OK on all the pop-up error messages does result in the .adm files
loading correctly, the new Windows XP SP2 policy settings that use the
LISTBOX syntax will not be displayed. (This problem does not occur on
computers running Windows XP with SP2 or computers that have been
updated with the latest version of gpedit.)
This issue is of particular significance because of the way .adm files are
distributed through a domain. By default, when a GPO is opened, a
comparison is made between the timestamps of the .adm files stored
in the GPO being edited and those on the local computer. If the local
.adm files have a more recent timestamp then they are uploaded to
the domain controller and replicated throughout the domain. From that
point, all earlier versions of gpedit use the new .adm files. This
scenario is illustrated in the following steps.
This section includes a complete reference guide for using the .adm
language to create policy settings.
Each .adm file can contain zero or more policy settings, and each
policy setting in turn can contain zero or more parts. The .adm
language includes the following components:
• Comments
• Strings
• CLASS
• CATEGORY
• POLICY
• PART
• ITEMLIST
• ACTIONLIST
Comments
You can use two methods to add comments to an .adm file. You can
precede the comment either with a semicolon (;) or with two forward
slashes (//). You can place comments at the end of any valid line.
Strings
To add strings to an .adm file, precede the text with two exclamation
points (!!). At the end of the .adm file, all strings must be defined in the
[strings] section. The strings must be enclosed in quotation marks (").
Optionally, you can enclose a variable name or hard-coded string in
quotation marks.
Example
Copy Code
POLICY 34]!!LimitSize
EXPLAIN!!LimitSize_Explain ; This string is stored in the strings secti
on
TIP1 "Limit Profile Size to" ; This string is hard coded
[strings]
LimitSize="Limit profile size"
LimitSize_Explain="Limits the size of user profiles"
Best Practice
Place all strings in the [strings] section of the .adm file. This facilitates
conversion of the .adm file to other languages (that is, for localization),
as you only need to modify the [strings] section of an .adm file to port
it to different languages.
CLASS
The first entry in the .adm file is the keyword CLASS. This specifies
whether the subsequent entries should be displayed under the
Computer Configuration or User Configuration node of Group
Policy Object Editor.
Syntax
The CLASS syntax is as follows:
Copy Code
CLASS name
Name
This defines the name of the CLASS, which must be MACHINE or USER.
If the .adm file contains a CLASS other than the valid classes
(MACHINE or USER), the errors are ignored when loaded in Group
Policy Object Editor.
Example
The following examples illustrate the use of the CLASS component.
Copy Code
CLASS MACHINE
CLASS USER
Note
CATEGORY
After you define the CLASS component, you can use the CATEGORY
component to display a node name under which your policy setting is
displayed in the Group Policy Object Editor.
Note
Copy Code
CATEGORY!!name
KEYNAME key name
[policy definition statements]
END CATEGORY
name
The CATEGORY name as it should appear in the Group Policy Object
Editor list box. Optionally, you can enclose the variable name in
quotation marks ("). Names with spaces must be enclosed in quotation
marks.
key name
The key name is an optional path to the registry key to use for the
CATEGORY.
Example
Copy Code
CLASS USER
CATEGORY !!Desktop
KEYNAME "Software\Policies\System"
CATEGORY !!InternalApps
KEYNAME "Software\Policies\InternalApps"
END CATEGORY
END CATEGORY
[strings]
Desktop="Desktop Settings"
InternalApps="Line of Business Apps settings"
Supported Tag
The Group Policy Object Editor uses the Supported tag to populate
the Requirements field. This tag informs the Group Policy
administrator about the platforms or applications for which the policy
setting is supported. For example, many of the policy settings included
in the System.adm file use a Supported tag that specifies a specific
service pack release. Often, the string used for the Supported tag will
make reference to multiple operating system or service packs.
• KEYNAME
• CATEGORY
• POLICY
• END
• SUPPORTED
Note
POLICY
To identify a policy setting that the user can modify, use the keyword
POLICY. The policy and its associated controls are displayed in a
dialog box that administrators use to set the state of the policy. You
can use multiple POLICY key names under one KEYNAME.
Syntax
Copy Code
POLICY name
[KEYNAME key name]
[EXPLAIN help string]
[VALUENAME value name]
[CLIENTEXT guid]
[part definition statements]
END POLICY
name
The name of the policy as it should be displayed in the Group Policy
Object Editor namespace.
key name
This is an optional path to the registry key to use for the category. Do
not include HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the
registry path as the preceding CLASS statement determines which of
these keys is used.
If you specify a key name, all PART definition statements will use this
key name unless they specifically provide a key name of their own.
help string
The Help string is the text displayed in the Explain tab of the dialog
box for the policy setting.
value name
Value name is the registry value to modify. Selecting this option sets
the value as a REG_DWORD of 1. Clearing the option removes the
registry value. To specify values other than the default values, use the
VALUEON and VALUEOFF statements directly following the
corresponding VALUENAME statement. These statements are
specified as follows:
Copy Code
VALUEON on value
VALUEOFF off value
When you use these statements, the behavior is modified such that if
the administrator selects the option, the value is set to on value. If the
administrator clears the option, the value is set to off value.
guid
This is an optional value that specifies the globally unique identifier
(GUID) of the snap-in extension.
POLICY Example
Copy Code
CLASS MACHINE
CATEGORY!!DiskQuota
KEYNAME "Software\Policies\MS\DiskQuota"
POLICY!!DQ_Enable
EXPLAIN !!DQ_Enable_Help
VALUENAME "Enable"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
CLIENTEXT {3610eda5-77ef-11d2-8dc}
PART!!DQ_EnableTip1 TEXT
END PART
END POLICY
END CATEGORY
[strings]
DiskQuota="Disk Quotas"
DQ_Enable="Enable disk quotas"
DQ_Enable_Help="Enables and disables disk quota management"
DQ_EnableTip1="Enable disk quotas for all NTFS volumes"
POLICY Keywords
The valid keywords for POLICY are:
• KEYNAME
• PART
• VALUENAME
• VALUEON
• VALUEOFF
• ACTIONLISTON
• ACTIONLISTOFF
• END
• HELP
• CLIENTEXT
• POLICY
PART
For a simple policy where you only need to set a registry key to either
1 or 0, you do not need to use PART. PART allows a richer system
administrator experience, and collects more information from the
administrator through simple controls.
Syntax
Copy Code
PART name part-type type-dependent data
[KEYNAME key name]
[VALUENAME value name]
END PART
name
Specifies the PART name as it should appear in Group Policy Object
Editor. You can enclose it in quotation marks ("). Names with spaces
must be enclosed in quotation marks (").
part-type
A policy PART type. Table 6 lists the valid types for POLICY.
Type Description
key name
This is an optional path to the registry key to use. Do not include
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the registry
path as the preceding CLASS statement determines which of these
keys is used.
value name
The value name indicates the registry value to modify. Selecting this
option sets the value to a REG_DWORD of 1, and clearing the option
removes the registry value. If you want to specify values other than
the default values, use the VALUEON and VALUEOFF statements
directly following the corresponding VALUENAME statement. You
specify these statements as follows:
Copy Code
VALUEON on value
VALUEOFF off value
Keywords
The valid keywords for PART are:
• CHECKBOX
• TEXT
• EDITTEXT
• NUMERIC
• COMBOBOX
• DROPDOWNLIST
• LISTBOX
• END
• CLIENTEXT
• PART
Using the different PART types, you can add text and controls to
enhance a policy setting. These types need to be used with the PART
component as previously defined.
Syntax
Copy Code
PART text CHECKBOX
VALUENAME value name
END PART
text
This represents the text to be displayed on the right of the check box
that you are creating. You can hard code it and enclose it in quotation
marks (") or you can make the string a variable by putting !! in front of
the variable name.
value name
Indicates the registry value to which the selected value will be written.
Selecting the option sets the value as a REG_DWORD of 1. Clearing the
option removes the registry value. To specify values other than the
default values, use the VALUEON and VALUEOFF statements directly
following the corresponding VALUENAME statement. These
statements are specified as follows:
Copy Code
VALUEON on value
VALUEOFF off value
When you use these statements, the behavior is modified such that if
the administrator selects the option, the value is set to on value. If the
administrator clears the option, the value is set to off value.
Copy Code
PART !!SampleChkBox_NotChked CHECKBOX
DEFCHECKED
VALUENAME "test1"
END PART
You can use VALUEON and VALUEOFF. This example accomplishes
the following::
• Writes the string "Enabled" to the registry when the check box is
selected.
• Writes a numeric value of 12 when the check box is not selected.
Copy Code
PART !!SampleChkBox_NotChked CHECKBOX
VALUENAME "test1"
VALUEON "Enabled"
VALUEOFF NUMERIC 12
END PART
To modify more than one registry key, use an ACTIONLIST.
• KEYNAME
• VALUENAME
• VALUEON
• VALUEOFF
• ACTIONLISTON
• ACTIONLISTOFF
• DEFCHECKED
• CLIENTEXT
• END
The following example illustrates the use of TEXT. The Disable Active
Desktop policy deactivates Active Desktop and prevents users from
enabling or disabling Active Desktop, or from modifying the
configuration.
TEXT Example
Copy Code
POLICY !!NoActiveDesktop
KEYNAME "Software\Microsoft\Windows\CurrentVersion\Policies\Explo
rer"
EXPLAIN!!NoActiveDesktop_Help
VALUENAME "NoActiveDesktop"
END POLICY
The valid keyword for TEXT is END.
Syntax
Copy Code
PART !!text EDITTEXT
VALUENAME value name
END PART
text
Text to be displayed is entered here. You can hard code it and enclose
it in quotation marks (") or you can make the string a variable by
putting two explanation points (!!) before the variable name. This text
is displayed on the left side of the edit box.
value name
The value name indicates the registry value to which the users input
entered in the Edit Text box will be written.
Option Description
DEFAULT value Specifies the initial string to place in the edit field.
If this option is not specified, the field is initially
empty.
MAXLEN value Specifies the maximum length of a string. The
string in the edit field is limited to this length.
REQUIRED Specifies that the Group Policy Object Editor does
not allow a policy containing this PART to be
enabled, unless a value has been entered for this
PART.
OEMCONVERT Sets the ES_OEMCONVERT style in the edit field
so that typed text is mapped from ASCII to OEM
and back. ES_OEMCONVERT converts text entered
in the edit control. The text is converted from the
Windows character set (ASCII) to the OEM
character set and then back to the Windows set.
This ensures proper character conversion when
the application calls the CharToOem
<JavaScript:hhobj_1.Click()> function to convert
an ASCII string in the edit control to OEM
characters. This style is most useful for edit
controls that contain file names.
EXPANDABLETEXT Specifies that the text is set in the registry with
the REG_EXPAND_SZ type. By default, the text is
set in the registry with the REG_SZ type
The valid keywords for EDITTEXT are:
• KEYNAME
• VALUENAME
• DEFAULT
• REQUIRED
• MAXLENGTH
• OEMCONVERT
• END
• EXPANDABLETEXT
• CLIENTEXT
EDITTEXT Example
An example of use of the PART component with EDITTEXT and TEXT
follows:
Copy Code
CLASS USER
CATEGORY !!DesktopLockDown
KEYNAME "Software\Policies\System"
POLICY !!Wallpaper
EXPLAIN !!Wallpaper_Explain
END POLICY
END CATEGORY
[strings]
DesktopLockDown="Desktop Settings"
Wallpaper="Desktop Wallpaper"
Wallpaper_Explain="Used to set the desktop wallpaper"
Wallpaper_FileName="Filename"
Wallpaper_Tip1="Specify UNC Path for selected wallpaper"
In the preceding example, the text entered into the edit field is written
to the registry key
HKEY_CURRENT_USER\Software\Policies\System\Wallpaper. The
text can be a maximum of 60 characters.
EXPANDABLETEXT Example
The following example writes a value to registry with data type
REG_EXPAND_SZ.
For example:
Copy Code
PART!!MyVariable EDITTEXT EXPANDABLETEXT
VALUENAME ValueToBeChanged
END PART
REQUIRED Example
The following example generates an error if the user does not enter a
value when required.
Copy Code
PART!!MyVariable EDITTEXT REQUIRED
VALUENAME ValueToBeChanged
END PART
MAXLEN Example
The following example specifies the maximum length of text.
Copy Code
PART!!MyVariable EDITTEXT
VALUENAME ValueToBeChanged
MAXLEN 4
END PART
DEFAULT Example
The following example specifies a default value. This can be used for
text or numeric data.
Copy Code
PART!!MyVariable EDITTEXT
DEFAULT !!MySampleText
VALUENAME ValueToBeChanged
END PART
NUMERIC PART Type
Displays an edit field with an optional spinner control (an up-down
control) that accepts a numeric value.
NUMERIC Syntax
Copy Code
PART text NUMERIC
VALUENAME value name
MIN value
MAX value
DEFAULT value
SPIN value
END PART
text
This represents the text to be displayed on the right of the spin control
that you are creating. You can hard code it and enclose it in quotation
marks (") or you can make the string a variable by putting !! before the
variable name.
value name
Indicates the registry value to which the selected value will be written.
Option Description
DEFAULT Specifies the initial numeric value for the edit field. If
value this option is not specified, the field is initially empty.
MAX value Specifies the maximum value for the number. The
default value is 9999.
MIN value Specifies the minimum value for the number. The
default value is 0.
REQUIRED Specifies that the Group Policy Object Editor does not
allow a policy containing this PART to be enabled
unless a value has been entered for this PART.
SPIN value Specifies increments to use for the spinner control.
The default is SPIN 1. SPIN 0 removes the spinner
control.
TXTCONVERT Writes values as REG_SZ strings ("1", "2", or "128")
rather than as binary values.
The valid keywords for NUMERIC are:
• KEYNAME
• VALUENAME
• MIN
• MAX
• SPIN
• DEFAULT
• REQUIRED
• TXTCONVERT
• END
• CLIENTEXT
Copy Code
PART!!MyVariable NUMERIC
DEFAULT 5
VALUENAME ValueToBeChanged
END PART
The following example illustrates use of the minimum and maximum
valid values for a variable.
Copy Code
PART!!MyVariable NUMERIC
MIN 100
MAX 999
DEFAULT 55
VALUENAME ValueToBeChanged
END PART
The following example illustrates use of the NUMERIC PART type
using SPIN. In this case, increments of 100 are used for the spin
control.
Copy Code
PART !!ProfileSize NUMERIC REQUIRED SPIN 100
VALUENAME "MaxProfileSize"
DEFAULT 30000
MAX 30000
MIN 300
END PART
The following example illustrates use of the NUMERIC PART type
using the TXTCONVERT option, which writes values as REG_SZ
strings (such as "60") instead of binary values.
Copy Code
PART !!ScreenSaverTimeOutFreqSpin NUMERIC DEFAULT 900
Example
The following example illustrates the use of the SUGGESTIONS
option.
Copy Code
SUGGESTIONS
Alaska Alabama Mississippi "New York"
END SUGGESTIONS
Keywords
The valid keywords for COMBOBOX are:
• KEYNAME
• VALUENAME
• DEFAULT
• SUGGESTIONS
• REQUIRED
• MAXLENGTH
• OEMCONVERT
• END
• NOSORT
• EXPANDABLETEXT
• CLIENTEXT
• END
DROPDOWNLIST PART Type
Displays a combo box with a drop-down list style. The user may choose
only one of the entries supplied.
Note
GPMC requires that you define the key name and value name before
you specify DROPDOWNLIST.
DROPDOWNLIST Syntax
DROPDOWNLIST uses the following syntax.
Copy Code
PART !!text DROPDOWNLIST
ITEMLIST
NAME name VALUE value
..
NAME name VALUE value
END ITEMLIST
END PART
text
This represents the text to be displayed on the right of the spin control
that you are creating. You can hard code it and enclose it in quotation
marks (") or you can make the string a variable by putting !! in front of
the variable name.
name
This is text that will be displayed in the drop-down list for a particular
item.
value
The value to be written to the specified registry key if this item is
selected. Values are assumed to be strings, unless they are preceded
by NUMERIC. The following example shows both string and numeric
values:
Copy Code
VALUE "Some value"
VALUE NUMERIC 1
The valid keywords for DROPDOWNLIST are:
• KEYNAME
• VALUENAME
• REQUIRED
• ITEMLIST
• END
• NOSORT
• CLIENTEXT
LISTBOX
Option Description
• KEYNAME
• VALUEPREFIX
• ADDITIVE
• NOSORT
• EXPLICITVALUE
• EXPANDABLETEXT
• END
• CLIENTEXT
Note
ACTIONLIST
You can use an action list to specify a set of arbitrary registry changes
to make in response to a control being set to a particular state.
Syntax
The ACTIONLIST syntax is as follows:
Copy Code
ACTIONLIST
[KEYNAME key name]
VALUENAME value name
VALUE value
END ACTIONLIST
key name
This is an optional path to the registry key. Do not include
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the registry path as
the preceding CLASS statement determines which of these keys is
used. If no key name is specified, the previous key name in the
hierarchy is used.
value name
Indicates the registry value to modify. Selecting this option sets the
value to a REG_DWORD of 1, and clearing the option removes the
registry value. If you want to specify values other than the default
values, use the VALUEON and VALUEOFF statements directly following
the corresponding VALUENAME statement. You specify these
statements as follows:
Copy Code
VALUEON on value
VALUEOFF off value
value
Values are treated as strings unless they are preceded by NUMERIC, as
in the following examples:
Copy Code
VALUE "Some value"
VALUE NUMERIC 1
If VALUE is followed by DELETE (for example, VALUE DELETE), the
registry entry is deleted.
Table 10 lists the two variants for ACTIONLIST that can be used with
POLICY and CHECKBOX.
Variant Description
Copy Code
POLICY "Deny connections requests"
EXPLAIN "If enabled, TS will stop accepting connections"
ACTIONLISTON
VALUENAME "fDenyTSConnections" VALUE NUMERIC 1
END ACTIONLISTON
ACTIONLISTOFF
VALUENAME "fDenyTSConnections" VALUE NUMERIC 0
END ACTIONLISTOFF
END POLICY
Additional Elements
VALUENAME
Defines the options available within a POLICY. First identify the
registry value that is to be modified as a result of using the keyword
VALUENAME. For example, VALUENAME MyFirstValue.
Copy Code
POLICY!!DisableStatusMessages
KEYNAME "Software\Microsoft\Windows\CurrentVersion\Policies\Syst
em"
EXPLAIN!!DisableStatusMessages_Help
VALUENAME "DisableStatusMessages"
END POLICY
Unless you specify otherwise, the value is written in the following
format when the user checks or clears the option:
CLIENTEXT
The CLIENTEXT keyword is used to specify which client-side extension
to the Group Policy Object Editor needs to process the particular
settings on the client computer. By default, the registry extension
processes all settings configured under the Administrative Templates
node. The CLIENTEXT keyword changes the default behavior and
causes the specified extension to process these settings after the
registry extension has placed them in the registry.
CLIENTEXT must be used within either the POLICY scope or the PART
scope and should follow the VALUENAME statement.
Copy Code
POLICY !!DQ_Enforce
EXPLAIN !!DQ_Enforce_Help
VALUENAME "Enforce"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
CLIENTEXT {3610eda5-77ef-11d2-8dc5-00c04fa31a66}
END POLICY
The GUID that follows the CLIENTEXT keyword is the GUID of the
client-side extension. The client-side extensions are listed in the
registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT
\CurrentVersion\Winlogon\GPExtensions.
Copy Code
KEYNAME key name
POLICY!!MyPolicy
VALUENAME ValueToBeChanged
VALUEON "Turned On" VALUEOFF "Turned Off"
END POLICY
Copy Code
KEYNAME key name
POLICY!!MyPolicy
VALUENAME ValueToBeChanged
VALUEON 5 VALUEOFF 10
END POLICY
Using Simple Policies and Policies with the VALUEOFF and
VALUEON Statements
This section presents two examples that illustrate the difference
between using the default policy states and specifying VALUEON and
VALUEOFF statements. There is a significant difference between the
two example policies.
Example 1
In this example, no explicit VALUEON or VALUEOFF statements are
used. This means that the Administrative Templates use the default
behavior when the user changes the state of this policy.
Copy Code
POLICY!!EnableSlowLinkDetect
EXPLAIN !!EnableSlowLinkDetect_Help
KEYNAME "Software\Policies\Microsoft\Windows\System"
VALUENAME "SlowLinkDetectEnabled"
END POLICY
Table 11 lists the default behavior.
State Behavior
Example 2
In this example, the state values are explicitly defined, so when the
user changes the policy, the Administrative Templates use these
values.
Copy Code
POLICY!!EnableSlowLinkDetect
EXPLAIN!!EnableSlowLinkDetect_Help
KEYNAME "Software\Policies\Microsoft\Windows\System"
VALUENAME "SlowLinkDetectEnabled"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
END POLICY
Table 12 lists the behaviors in Example 2.
State Behavior
Each Group Policy that you create should include one EXPLAIN
keyword, followed by at least one space, and then the EXPLAIN string
in quotation marks (") or a reference to the Help string. For example:
Copy Code
POLICY!!Pol_NoConfigCache
#if VERSION >= 3
EXPLAIN!!Pol_NoConfigCache_Help
#endif
VALUENAME "NoConfigCache"
PART!!Lbl_NoConfigCacheHelp1 TEXT
END PART
END POLICY
.....
[Strings]
Pol_NoConfigCache_Help="Prevents users from changing the automati
c
synchronization behavior at logoff."
In the preceding example, Help is offered for one of the Offline Files
options. The EXPLAIN keyword wrapped in the #if VERSION allows
this .adm file to be used with the Windows 2000 Group Policy Object
Editor (version 3).
Line Breaks
To start text on a new line or to create a line break, use this syntax:
Copy Code
\n = Starts a new line
\n\n = Creates a line break
#If Version for Version Comparison
The IF VERSION conditional statement is used to control the display of
certain policy settings and features in the Administrative Templates
node, based on the version of the Group Policy Object Editor that you
are using. IF VERSION allows for part of the .adm files to be
conditionally parsed and ignored by earlier versions of the Group Policy
Object Editor tool. For example, the SUPPORTED tag is not supported
on versions of the Group Policy Object Editor earlier than version 4. For
this reason any statement using the SUPPORTED tag should be
enclosed by #If Version...#endif.
You can specify that any part of your .adm file be evaluated only in
specific versions of the Group Policy editing tools, as shown in Table 5,
in the ".Adm File Language Versions" section of this document.
Copy Code
#if Version (operator) x
#endif
The valid operators are listed in Table 13.
Operato
r Signifies
> (GT) Greater than. For example, a > b means a is greater than b.
< (LT) Less than. For example, a < b means a is less than b.
== (EQ) Equal. For example, a == b means a is equal to b.
!= (NE) Not equal.
>= Greater than or equal to. For example, a >= b means a is
(GTE) greater than or equal to b.
<= Less than or equal to. For example, a <= b means a is less
(LTE) than or equal to b.
Table 14
Each .adm file can contain zero or more policy settings, and each
policy setting in turn can contain zero or more parts. The .adm
language includes the following components:
• Comments
• Strings
• CLASS
• CATEGORY
• POLICY
• PART
• ITEMLIST
• ACTIONLIST
You can specify that any part of your .adm file be evaluated only in
specific versions of the Group Policy editing tools. Table 5 lists the
versions of the Group Policy editing tools.
Comments
You can use two methods to add comments to an .adm file. You can
precede the comment either with a semicolon (;) or with two forward
slashes (//). You can place comments at the end of any valid line.
Strings
To add strings to an .adm file, precede the text with two exclamation
points (!!). At the end of the .adm file, all strings must be defined in the
[strings] section. The strings must be enclosed in quotation marks (").
Optionally, you can enclose a variable name or hard-coded string in
quotation marks.
Example
Copy Code
POLICY 34]!!LimitSize
EXPLAIN!!LimitSize_Explain ; This string is stored in the strings secti
on
TIP1 "Limit Profile Size to" ; This string is hard coded
[strings]
LimitSize="Limit profile size"
LimitSize_Explain="Limits the size of user profiles"
Best Practice
Place all strings in the [strings] section of the .adm file. This facilitates
conversion of the .adm file to other languages (that is, for localization),
as you only need to modify the [strings] section of an .adm file to port
it to different languages.
CLASS
This component defines where your policy setting is displayed in the
Group Policy Object Editor.
The first entry in the .adm file is the keyword CLASS. This specifies
whether the subsequent entries should be displayed under the
Computer Configuration or User Configuration node of Group
Policy Object Editor.
Syntax
The CLASS syntax is as follows:
Copy Code
CLASS name
Name
This defines the name of the CLASS, which must be MACHINE or USER.
If the .adm file contains a CLASS other than the valid classes
(MACHINE or USER), the errors are ignored when loaded in Group
Policy Object Editor.
Example
The following examples illustrate the use of the CLASS component.
Copy Code
CLASS MACHINE
CLASS USER
Note
CATEGORY
After you define the CLASS component, you can use the CATEGORY
component to display a node name under which your policy setting is
displayed in the Group Policy Object Editor.
Note
Copy Code
CATEGORY!!name
KEYNAME key name
[policy definition statements]
END CATEGORY
name
The CATEGORY name as it should appear in the Group Policy Object
Editor list box. Optionally, you can enclose the variable name in
quotation marks ("). Names with spaces must be enclosed in quotation
marks.
key name
The key name is an optional path to the registry key to use for the
CATEGORY.
Example
Copy Code
CLASS USER
CATEGORY !!Desktop
KEYNAME "Software\Policies\System"
CATEGORY !!InternalApps
KEYNAME "Software\Policies\InternalApps"
END CATEGORY
END CATEGORY
[strings]
Desktop="Desktop Settings"
InternalApps="Line of Business Apps settings"
Supported Tag
The Group Policy Object Editor uses the Supported tag to populate
the Requirements field. This tag informs the Group Policy
administrator about the platforms or applications for which the policy
setting is supported. For example, many of the policy settings included
in the System.adm file use a Supported tag that specifies a specific
service pack release. Often, the string used for the Supported tag will
make reference to multiple operating system or service packs.
Copy Code
#if version >= 4
SUPPORTED!!SUPPORTED_MyApplication
#endif
CATEGORY Keywords
The valid keywords for CATEGORY are:
• KEYNAME
• CATEGORY
• POLICY
• END
• SUPPORTED
Note
POLICY
To identify a policy setting that the user can modify, use the keyword
POLICY. The policy and its associated controls are displayed in a
dialog box that administrators use to set the state of the policy. You
can use multiple POLICY key names under one KEYNAME.
Syntax
Copy Code
POLICY name
[KEYNAME key name]
[EXPLAIN help string]
[VALUENAME value name]
[CLIENTEXT guid]
[part definition statements]
END POLICY
name
The name of the policy as it should be displayed in the Group Policy
Object Editor namespace.
key name
This is an optional path to the registry key to use for the category. Do
not include HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the
registry path as the preceding CLASS statement determines which of
these keys is used.
If you specify a key name, all PART definition statements will use this
key name unless they specifically provide a key name of their own.
help string
The Help string is the text displayed in the Explain tab of the dialog
box for the policy setting.
value name
Value name is the registry value to modify. Selecting this option sets
the value as a REG_DWORD of 1. Clearing the option removes the
registry value. To specify values other than the default values, use the
VALUEON and VALUEOFF statements directly following the
corresponding VALUENAME statement. These statements are
specified as follows:
Copy Code
VALUEON on value
VALUEOFF off value
When you use these statements, the behavior is modified such that if
the administrator selects the option, the value is set to on value. If the
administrator clears the option, the value is set to off value.
guid
This is an optional value that specifies the globally unique identifier
(GUID) of the snap-in extension.
POLICY Example
Copy Code
CLASS MACHINE
CATEGORY!!DiskQuota
KEYNAME "Software\Policies\MS\DiskQuota"
POLICY!!DQ_Enable
EXPLAIN !!DQ_Enable_Help
VALUENAME "Enable"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
CLIENTEXT {3610eda5-77ef-11d2-8dc}
PART!!DQ_EnableTip1 TEXT
END PART
END POLICY
END CATEGORY
[strings]
DiskQuota="Disk Quotas"
DQ_Enable="Enable disk quotas"
DQ_Enable_Help="Enables and disables disk quota management"
DQ_EnableTip1="Enable disk quotas for all NTFS volumes"
POLICY Keywords
The valid keywords for POLICY are:
• KEYNAME
• PART
• VALUENAME
• VALUEON
• VALUEOFF
• ACTIONLISTON
• ACTIONLISTOFF
• END
• HELP
• CLIENTEXT
• POLICY
PART
For a simple policy where you only need to set a registry key to either
1 or 0, you do not need to use PART. PART allows a richer system
administrator experience, and collects more information from the
administrator through simple controls.
Syntax
Copy Code
PART name part-type type-dependent data
[KEYNAME key name]
[VALUENAME value name]
END PART
name
Specifies the PART name as it should appear in Group Policy Object
Editor. You can enclose it in quotation marks ("). Names with spaces
must be enclosed in quotation marks (").
part-type
A policy PART type. Table 6 lists the valid types for POLICY.
Type Description
key name
This is an optional path to the registry key to use. Do not include
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the registry
path as the preceding CLASS statement determines which of these
keys is used.
value name
The value name indicates the registry value to modify. Selecting this
option sets the value to a REG_DWORD of 1, and clearing the option
removes the registry value. If you want to specify values other than
the default values, use the VALUEON and VALUEOFF statements
directly following the corresponding VALUENAME statement. You
specify these statements as follows:
Copy Code
VALUEON on value
VALUEOFF off value
Keywords
The valid keywords for PART are:
• CHECKBOX
• TEXT
• EDITTEXT
• NUMERIC
• COMBOBOX
• DROPDOWNLIST
• LISTBOX
• END
• CLIENTEXT
• PART
Using the different PART types, you can add text and controls to
enhance a policy setting. These types need to be used with the PART
component as previously defined.
Syntax
Copy Code
PART text CHECKBOX
VALUENAME value name
END PART
text
This represents the text to be displayed on the right of the check box
that you are creating. You can hard code it and enclose it in quotation
marks (") or you can make the string a variable by putting !! in front of
the variable name.
value name
Indicates the registry value to which the selected value will be written.
Selecting the option sets the value as a REG_DWORD of 1. Clearing the
option removes the registry value. To specify values other than the
default values, use the VALUEON and VALUEOFF statements directly
following the corresponding VALUENAME statement. These
statements are specified as follows:
Copy Code
VALUEON on value
VALUEOFF off value
When you use these statements, the behavior is modified such that if
the administrator selects the option, the value is set to on value. If the
administrator clears the option, the value is set to off value.
Copy Code
PART !!SampleChkBox_NotChked CHECKBOX
DEFCHECKED
VALUENAME "test1"
END PART
You can use VALUEON and VALUEOFF. This example accomplishes
the following::
• Writes the string "Enabled" to the registry when the check box is
selected.
• Writes a numeric value of 12 when the check box is not selected.
Copy Code
PART !!SampleChkBox_NotChked CHECKBOX
VALUENAME "test1"
VALUEON "Enabled"
VALUEOFF NUMERIC 12
END PART
To modify more than one registry key, use an ACTIONLIST.
• KEYNAME
• VALUENAME
• VALUEON
• VALUEOFF
• ACTIONLISTON
• ACTIONLISTOFF
• DEFCHECKED
• CLIENTEXT
• END
Copy Code
PART text TEXT
END PART
text
Text that is to be displayed is entered here. You can hard code it and
enclose it in quotation marks ("), or you can make the string a variable
by putting !! before the variable name.
The following example illustrates the use of TEXT. The Disable Active
Desktop policy deactivates Active Desktop and prevents users from
enabling or disabling Active Desktop, or from modifying the
configuration.
TEXT Example
Copy Code
POLICY !!NoActiveDesktop
KEYNAME "Software\Microsoft\Windows\CurrentVersion\Policies\Explo
rer"
EXPLAIN!!NoActiveDesktop_Help
VALUENAME "NoActiveDesktop"
END POLICY
The valid keyword for TEXT is END.
Syntax
Copy Code
PART !!text EDITTEXT
VALUENAME value name
END PART
text
Text to be displayed is entered here. You can hard code it and enclose
it in quotation marks (") or you can make the string a variable by
putting two explanation points (!!) before the variable name. This text
is displayed on the left side of the edit box.
value name
The value name indicates the registry value to which the users input
entered in the Edit Text box will be written.
Option Description
DEFAULT value Specifies the initial string to place in the edit field.
If this option is not specified, the field is initially
empty.
MAXLEN value Specifies the maximum length of a string. The
string in the edit field is limited to this length.
REQUIRED Specifies that the Group Policy Object Editor does
not allow a policy containing this PART to be
enabled, unless a value has been entered for this
PART.
OEMCONVERT Sets the ES_OEMCONVERT style in the edit field
so that typed text is mapped from ASCII to OEM
and back. ES_OEMCONVERT converts text entered
in the edit control. The text is converted from the
Windows character set (ASCII) to the OEM
character set and then back to the Windows set.
This ensures proper character conversion when
the application calls the CharToOem
<JavaScript:hhobj_1.Click()> function to convert
an ASCII string in the edit control to OEM
characters. This style is most useful for edit
controls that contain file names.
EXPANDABLETEXT Specifies that the text is set in the registry with
the REG_EXPAND_SZ type. By default, the text is
set in the registry with the REG_SZ type
The valid keywords for EDITTEXT are:
• KEYNAME
• VALUENAME
• DEFAULT
• REQUIRED
• MAXLENGTH
• OEMCONVERT
• END
• EXPANDABLETEXT
• CLIENTEXT
EDITTEXT Example
An example of use of the PART component with EDITTEXT and TEXT
follows:
Copy Code
CLASS USER
CATEGORY !!DesktopLockDown
KEYNAME "Software\Policies\System"
POLICY !!Wallpaper
EXPLAIN !!Wallpaper_Explain
END POLICY
END CATEGORY
[strings]
DesktopLockDown="Desktop Settings"
Wallpaper="Desktop Wallpaper"
Wallpaper_Explain="Used to set the desktop wallpaper"
Wallpaper_FileName="Filename"
Wallpaper_Tip1="Specify UNC Path for selected wallpaper"
In the preceding example, the text entered into the edit field is written
to the registry key
HKEY_CURRENT_USER\Software\Policies\System\Wallpaper. The
text can be a maximum of 60 characters.
EXPANDABLETEXT Example
The following example writes a value to registry with data type
REG_EXPAND_SZ.
For example:
Copy Code
PART!!MyVariable EDITTEXT EXPANDABLETEXT
VALUENAME ValueToBeChanged
END PART
REQUIRED Example
The following example generates an error if the user does not enter a
value when required.
Copy Code
PART!!MyVariable EDITTEXT REQUIRED
VALUENAME ValueToBeChanged
END PART
MAXLEN Example
The following example specifies the maximum length of text.
Copy Code
PART!!MyVariable EDITTEXT
VALUENAME ValueToBeChanged
MAXLEN 4
END PART
DEFAULT Example
The following example specifies a default value. This can be used for
text or numeric data.
Copy Code
PART!!MyVariable EDITTEXT
DEFAULT !!MySampleText
VALUENAME ValueToBeChanged
END PART
NUMERIC PART Type
Displays an edit field with an optional spinner control (an up-down
control) that accepts a numeric value.
NUMERIC Syntax
Copy Code
PART text NUMERIC
VALUENAME value name
MIN value
MAX value
DEFAULT value
SPIN value
END PART
text
This represents the text to be displayed on the right of the spin control
that you are creating. You can hard code it and enclose it in quotation
marks (") or you can make the string a variable by putting !! before the
variable name.
value name
Indicates the registry value to which the selected value will be written.
Option Description
DEFAULT Specifies the initial numeric value for the edit field. If
value this option is not specified, the field is initially empty.
MAX value Specifies the maximum value for the number. The
default value is 9999.
MIN value Specifies the minimum value for the number. The
default value is 0.
REQUIRED Specifies that the Group Policy Object Editor does not
allow a policy containing this PART to be enabled
unless a value has been entered for this PART.
SPIN value Specifies increments to use for the spinner control.
The default is SPIN 1. SPIN 0 removes the spinner
control.
TXTCONVERT Writes values as REG_SZ strings ("1", "2", or "128")
rather than as binary values.
The valid keywords for NUMERIC are:
• KEYNAME
• VALUENAME
• MIN
• MAX
• SPIN
• DEFAULT
• REQUIRED
• TXTCONVERT
• END
• CLIENTEXT
Copy Code
PART!!MyVariable NUMERIC
DEFAULT 5
VALUENAME ValueToBeChanged
END PART
The following example illustrates use of the minimum and maximum
valid values for a variable.
Copy Code
PART!!MyVariable NUMERIC
MIN 100
MAX 999
DEFAULT 55
VALUENAME ValueToBeChanged
END PART
The following example illustrates use of the NUMERIC PART type
using SPIN. In this case, increments of 100 are used for the spin
control.
Copy Code
PART !!ProfileSize NUMERIC REQUIRED SPIN 100
VALUENAME "MaxProfileSize"
DEFAULT 30000
MAX 30000
MIN 300
END PART
The following example illustrates use of the NUMERIC PART type
using the TXTCONVERT option, which writes values as REG_SZ
strings (such as "60") instead of binary values.
Copy Code
PART !!ScreenSaverTimeOutFreqSpin NUMERIC DEFAULT 900
Copy Code
SUGGESTIONS
Alaska Alabama Mississippi "New York"
END SUGGESTIONS
Keywords
The valid keywords for COMBOBOX are:
• KEYNAME
• VALUENAME
• DEFAULT
• SUGGESTIONS
• REQUIRED
• MAXLENGTH
• OEMCONVERT
• END
• NOSORT
• EXPANDABLETEXT
• CLIENTEXT
• END
Note
GPMC requires that you define the key name and value name before
you specify DROPDOWNLIST.
DROPDOWNLIST Syntax
DROPDOWNLIST uses the following syntax.
Copy Code
PART !!text DROPDOWNLIST
ITEMLIST
NAME name VALUE value
..
NAME name VALUE value
END ITEMLIST
END PART
text
This represents the text to be displayed on the right of the spin control
that you are creating. You can hard code it and enclose it in quotation
marks (") or you can make the string a variable by putting !! in front of
the variable name.
name
This is text that will be displayed in the drop-down list for a particular
item.
value
The value to be written to the specified registry key if this item is
selected. Values are assumed to be strings, unless they are preceded
by NUMERIC. The following example shows both string and numeric
values:
Copy Code
VALUE "Some value"
VALUE NUMERIC 1
The valid keywords for DROPDOWNLIST are:
• KEYNAME
• VALUENAME
• REQUIRED
• ITEMLIST
• END
• NOSORT
• CLIENTEXT
LISTBOX
Option Description
• KEYNAME
• VALUEPREFIX
• ADDITIVE
• NOSORT
• EXPLICITVALUE
• EXPANDABLETEXT
• END
• CLIENTEXT
Note
ACTIONLIST
You can use an action list to specify a set of arbitrary registry changes
to make in response to a control being set to a particular state.
Syntax
The ACTIONLIST syntax is as follows:
Copy Code
ACTIONLIST
[KEYNAME key name]
VALUENAME value name
VALUE value
END ACTIONLIST
key name
This is an optional path to the registry key. Do not include
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the registry path as
the preceding CLASS statement determines which of these keys is
used. If no key name is specified, the previous key name in the
hierarchy is used.
value name
Indicates the registry value to modify. Selecting this option sets the
value to a REG_DWORD of 1, and clearing the option removes the
registry value. If you want to specify values other than the default
values, use the VALUEON and VALUEOFF statements directly following
the corresponding VALUENAME statement. You specify these
statements as follows:
Copy Code
VALUEON on value
VALUEOFF off value
value
Values are treated as strings unless they are preceded by NUMERIC, as
in the following examples:
Copy Code
VALUE "Some value"
VALUE NUMERIC 1
If VALUE is followed by DELETE (for example, VALUE DELETE), the
registry entry is deleted.
Table 10 lists the two variants for ACTIONLIST that can be used with
POLICY and CHECKBOX.
Table 10 Variants for ACTIONLIST
Variant Description
Copy Code
POLICY "Deny connections requests"
EXPLAIN "If enabled, TS will stop accepting connections"
ACTIONLISTON
VALUENAME "fDenyTSConnections" VALUE NUMERIC 1
END ACTIONLISTON
ACTIONLISTOFF
VALUENAME "fDenyTSConnections" VALUE NUMERIC 0
END ACTIONLISTOFF
END POLICY
Additional Elements
KEYNAME
The KEYNAME keyword is used within a CATEGORY to define which
key within the registry is modified as a result of an action here.
KEYNAME should be followed by the registry path to the key that
contains the value that you want to change. Do not include
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER in the registry
path as the preceding CLASS statement determines which of these
keys is used.
VALUENAME
Defines the options available within a POLICY. First identify the
registry value that is to be modified as a result of using the keyword
VALUENAME. For example, VALUENAME MyFirstValue.
Copy Code
POLICY!!DisableStatusMessages
KEYNAME "Software\Microsoft\Windows\CurrentVersion\Policies\Syst
em"
EXPLAIN!!DisableStatusMessages_Help
VALUENAME "DisableStatusMessages"
END POLICY
Unless you specify otherwise, the value is written in the following
format when the user checks or clears the option:
You can specify options other than these defaults by using VALUEOFF
and VALUEON. If the option is to be selected within the lower pane of
the Group Policy Object Editor, the VALUENAME needs to be within a
PART scope.
CLIENTEXT
The CLIENTEXT keyword is used to specify which client-side extension
to the Group Policy Object Editor needs to process the particular
settings on the client computer. By default, the registry extension
processes all settings configured under the Administrative Templates
node. The CLIENTEXT keyword changes the default behavior and
causes the specified extension to process these settings after the
registry extension has placed them in the registry.
CLIENTEXT must be used within either the POLICY scope or the PART
scope and should follow the VALUENAME statement.
Copy Code
POLICY !!DQ_Enforce
EXPLAIN !!DQ_Enforce_Help
VALUENAME "Enforce"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
CLIENTEXT {3610eda5-77ef-11d2-8dc5-00c04fa31a66}
END POLICY
The GUID that follows the CLIENTEXT keyword is the GUID of the
client-side extension. The client-side extensions are listed in the
registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT
\CurrentVersion\Winlogon\GPExtensions.
Copy Code
KEYNAME key name
POLICY!!MyPolicy
VALUENAME ValueToBeChanged
VALUEON "Turned On" VALUEOFF "Turned Off"
END POLICY
Copy Code
KEYNAME key name
POLICY!!MyPolicy
VALUENAME ValueToBeChanged
VALUEON 5 VALUEOFF 10
END POLICY
Using Simple Policies and Policies with the VALUEOFF and
VALUEON Statements
This section presents two examples that illustrate the difference
between using the default policy states and specifying VALUEON and
VALUEOFF statements. There is a significant difference between the
two example policies.
Example 1
In this example, no explicit VALUEON or VALUEOFF statements are
used. This means that the Administrative Templates use the default
behavior when the user changes the state of this policy.
Copy Code
POLICY!!EnableSlowLinkDetect
EXPLAIN !!EnableSlowLinkDetect_Help
KEYNAME "Software\Policies\Microsoft\Windows\System"
VALUENAME "SlowLinkDetectEnabled"
END POLICY
Table 11 lists the default behavior.
State Behavior
Example 2
In this example, the state values are explicitly defined, so when the
user changes the policy, the Administrative Templates use these
values.
Copy Code
POLICY!!EnableSlowLinkDetect
EXPLAIN!!EnableSlowLinkDetect_Help
KEYNAME "Software\Policies\Microsoft\Windows\System"
VALUENAME "SlowLinkDetectEnabled"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
END POLICY
Table 12 lists the behaviors in Example 2.
State Behavior
Each Group Policy that you create should include one EXPLAIN
keyword, followed by at least one space, and then the EXPLAIN string
in quotation marks (") or a reference to the Help string. For example:
Copy Code
POLICY!!Pol_NoConfigCache
#if VERSION >= 3
EXPLAIN!!Pol_NoConfigCache_Help
#endif
VALUENAME "NoConfigCache"
PART!!Lbl_NoConfigCacheHelp1 TEXT
END PART
END POLICY
.....
[Strings]
Pol_NoConfigCache_Help="Prevents users from changing the automati
c
synchronization behavior at logoff."
In the preceding example, Help is offered for one of the Offline Files
options. The EXPLAIN keyword wrapped in the #if VERSION allows
this .adm file to be used with the Windows 2000 Group Policy Object
Editor (version 3).
Line Breaks
To start text on a new line or to create a line break, use this syntax:
Copy Code
\n = Starts a new line
\n\n = Creates a line break
#If Version for Version Comparison
The IF VERSION conditional statement is used to control the display of
certain policy settings and features in the Administrative Templates
node, based on the version of the Group Policy Object Editor that you
are using. IF VERSION allows for part of the .adm files to be
conditionally parsed and ignored by earlier versions of the Group Policy
Object Editor tool. For example, the SUPPORTED tag is not supported
on versions of the Group Policy Object Editor earlier than version 4. For
this reason any statement using the SUPPORTED tag should be
enclosed by #If Version...#endif.
You can specify that any part of your .adm file be evaluated only in
specific versions of the Group Policy editing tools, as shown in Table 5,
in the ".Adm File Language Versions" section of this document.
Copy Code
#if Version (operator) x
#endif
The valid operators are listed in Table 13.
Operato
r Signifies
> (GT) Greater than. For example, a > b means a is greater than b.
< (LT) Less than. For example, a < b means a is less than b.
== (EQ) Equal. For example, a == b means a is equal to b.
!= (NE) Not equal.
>= Greater than or equal to. For example, a >= b means a is
(GTE) greater than or equal to b.
<= Less than or equal to. For example, a <= b means a is less
(LTE) than or equal to b.
Table 14