共用方式為


enum Element

Applies To: Windows Server 2008

The enum element sets the specified registry subkey to a specified value or a list of registry subkeys to values chosen from a drop-down list when a policy setting is enabled through the Group Policy Object Editor.

Syntax

<enum    id="<placeholderID>"
         clientExtension="<placeholderGUID>"
         key="<placeholderRegKey>"
         valuename="<placeholderName>"
         required="true|false" >
     <item> … </item>
</enum >

Attributes

Attributes Required Description

id Attribute

Yes

A mapping to the enum element.

clientExtension Attribute

No

The client-side extension will process, on the client computer, the particular settings represented by the enum element.

key Attribute

No

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

valueName Attribute

Yes

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

required Attribute

No

Requirement to enter a value in the parameter box.

Child elements

Element Required Description

item Element (enum)

No

Represents a set of display names with one value or a set of registry subkey values.

Note

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

Remarks

The enum element is generally associated with a drop-down list parameter in the Group Policy Object Editor.

The enum element will require a matching dropdownList element in the corresponding .adml file with id that matches as declared in the enum element.

Examples

This XML fragment is an example of an enum element thatis associated with a choice of three values with different display names in a drop-down list.

        <enum id="Sample_Dropdownlist_Box" 
                 valueName="Example2DropDownList" required="true">
          <item displayName="$(string.Sample_DropDownList_First)">
            <value>
              <decimal value="1" />
            </value>
          </item>
          <item displayName="$(string.Sample_DropDownList_Second)">
            <value>
              <decimal value="2" />
            </value>
          </item>
          <item displayName="$(string.Sample_DropDownList_Third)">
            <value>
              <decimal value="3" />
            </value>
          </item>
        </enum>

This XML fragment is an example of an enum element that is associated with a choice of two sets of values (defined in ADM files as an ACTIONLIST) with different display names in a drop-down list.

     <elements>
        <enum id="enum_example" valueName="exampleValueName" required="true">
          <item displayName="$(string.displayChoice1)">
            <value>
              <decimal value="1" />
            </value>
            <valueList>
              <item key="Software\Policies\Examples\1" valueName="1">
                <value>
                  <decimal value="3" />
                </value>
              </item>
              <item key="Software\Policies\Examples\2" valueName="2">
                <value>
                  <decimal value="3" />
                </value>
              </item>
            </valueList>
          </item>
          <item displayName="$(string.displayChoice2)">
            <value>
              <decimal value="2" />
            </value>
            <valueList>
              <item key="Software\Policies\Examples\1" valueName="1">
                <value>
                  <decimal value="1" />
                </value>
              </item>
              <item key="Software\Policies\Examples\2" valueName="2">
                <value>
                  <decimal value="3" />
                </value>
              </item>
            </valueList>
          </item>
        </enum>
      </elements>

Additional references

elements Element

dropdownList Element