Share via


policy Element

Applies To: Windows Server 2008

The policy element corresponds to a single Group Policy setting displayed in the Local Group Policy Editor or Group Policy Management Console. The policy element describes all of the information about the policy setting, but includes a reference to the parameter definition.

Syntax

The syntax of the policy element declaration is:

    <policy name="="<placeholder for logical or friendly name>"
            class="Machine|User|Both"
            displayName="$(string.<placeholder for category text>)"
            explainText="$(string.<placeholder for help text>)"
            presentation="$(presentation.<parameter placeholder>)"
            key="<placeholder for registry key>"
            valueName="<placeholder for registry valuename>">
     <parentCategory> … </parentCategory>
     <supportedOn> … </supportedOn>
     <enabledValue> … </enabledValue>
     <disabledValue> … </disabledValue>
     <enabledList> … </enabledList>
     <disabledList> … </disabledList>
     <elements> … </elements>
    </policy>

Attributes

Attributes Required Description

name Attribute

Yes

name="<placeholder for logical or friendly name>"

Specifies a logical name to use for a specific supported application and revision.

class Attribute

Yes

Identifies whether the policy will be located under a single node of the Local Group Policy Editor or Group Policy Management Console (computer or user) or both nodes. The class attribute can be defined as "User," "Machine," or "Both."

displayName Attribute

Yes

displayName="$( string.<placeholder for category text>)"

The reference to the policy setting title text string located in the string table of the .adml file.

explainText Attribute

No

explainText="$( string.<placeholder for help text>)">

Explain or Help text associated with a specific policy setting.

presentation Attribute

No

presentation="$(presentation.<parameter placeholder>)"

An identifier used to reference the localized portions of the parameter definition located in the presentation table of the .adml file.

key Attribute

Yes

The registry key location under which the registry value will be created.

valueName Attribute

No

The registry value that will be configured for this specific policy element.

Child elements

Element Required Description

parentCategory Element

Yes

Reference to parent of the current category.

seeAlso Element element

No

Reference to another element that may be related. This element is not supported and will be ignored by current Group Policy.

keywords Element

No

Contains index words that could be used to search for elements. This element is not supported and will be ignored by current Group Policy tools.

supportedOn Element (policy)

No

supportedOn logical name as defined in the supportedOn element for this file.

enabledValue Element

No

A decimal or string value representing the enabled value of the registry valueName element.

disabledValue Element

No

A decimal or string value representing the disabled value of the registry valueName element.

enabledList Element

No

A set of decimal or string values and registry keys representing the enabled state of the policy element.

disabledList Element

No

A set of decimal or string values and registry keys representing the disabled state of the policy element.

elements Element

No

One of five parameters types that can be set in a policy setting.

Note

For simplicity of documentation, nested elements located one level down, known as child elements, will only be described for a given element.

Remarks

One thing to keep in mind when declaring a policy element is that you have the freedom to mix and match the elements for enabling and disabling the policy element. For example, you can declare an enabledValue with a disabledList element. You do not have to match the enabledValue with a disabledValue or an enabledList with a disabledList.

You can even define a policy element with only a parameter to the policy element through the presentation attribute. This will have the net effect of only setting a registry value when the policy is enabled with a set parameter. In this case, you will still need to define a registry key as a policy attribute, even though the registry key will be determined through the parameter definition via the referenced presentation table entry.

Examples

This XML fragment is an example of a single policy element that defines a policy setting configured to a string value based on the enabled or disabled state.

    <policy name="Sample_NoParamPolicy" class="Both" displayName="$(string.Sample_NoParamPolicy)" explainText="$(string.Sample_NoParamPolicy_Help)" key="Software\Policies\Examples" valueName="Example1NoParam">
      <parentCategory ref="SAMPLE" />
      <supportedOn ref="SUPPORTED_ProductOnly" />
      <enabledValue>
        <decimal value="1" />
      </enabledValue>
      <disabledValue>
        <decimal value="0" />
      </disabledValue>
    </policy>

This XML fragment is an example of a policy element that contains only a text input box parameter definition declared through the elements element.

    <policy name="Sample_Textbox" class="User"
            displayName="$(string.Sample_Textbox)"
            explainText="$(string.Sample_Textbox_Help)"
            presentation="$(presentation.Sample_Textbox)"
            key="Software\Policies\Examples">
      <parentCategory ref="TEXTBOX_CATEGORY" />
      <supportedOn ref="SUPPORTED_ProductOnly" />
      <elements>
        <text id="Sample_TextboxPrompt" valueName="Example2textbox" />
      </elements>
    </policy>

Additional references

policies Element