Platform SDK: Group Policy

PART

Specifies various options, including drop-down list boxes, text boxes, and text in the lower pane of the Group Policy snap-in. A policy part is specified as follows:

PART name part-type
type-dependent data
[KEYNAME key name ]
VALUENAME value name
END PART

name
Part name as it should appear in the Group Policy snap-in.
part-type
Policy part type. This parameter can be one of the following values.
Type Description
CHECKBOX Displays a check box. The value is set in the registry with the REG_DWORD type. The value is nonzero if the check box is checked and zero if it is not checked.
COMBOBOX Displays a combo box.
DROPDOWNLIST Displays a combo box with a drop-down list style. The user may choose only one of the entries supplied.
EDITTEXT Displays a text box that accepts alphanumeric text. The text is set in the registry with either the REG_SZ or the REG_EXPAND_SZ type.
LISTBOX Displays a list box with Add and Remove buttons. This is the only part type that can be used to manage multiple values under one key.
NUMERIC Displays a text box with an optional spin control that accepts a numeric value. The value is set in the registry with the REG_DWORD type.
TEXT Displays a line of static text. There is no associated registry value with this part type.

type-dependent data
Type-dependent data. Possible values are discussed in the following Remarks section.
key name
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. The preceding CLASS statement determines which of these keys will be used.
value name
Registry value that will be modified. If the administrator selects the option, the value is a REG_DWORD set to 1. If the administrator clears the option, the registry value is removed. 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:

VALUEON on value

VALUEOFF off value

Remarks

The following tables describe the policy part types.

CHECKBOX Part Type

The CHECKBOX part type accepts the following options.

Option Description
ACTIONLISTOFF Specifies an optional action list to be used if the check box is cleared. For more information, see ACTIONLIST.
ACTIONLISTON Specifies an optional action list to be used if the check box is selected. For more information, see ACTIONLIST.
DEFCHECKED Causes the check box to be initially selected.
VALUEOFF Overrides the default behavior of the check box if it is cleared.
VALUEON Overrides the default behavior of the check box if it is selected.

The default behavior of a check box is to write the value 1 to the registry if it is selected and zero if it is cleared. The VALUEON and VALUEOFF options override this behavior. For example, the following option writes "Turned on" to the registry when the check box is selected:

VALUEON "Turned on" 

The following statement writes the value 12 to the registry when the check box is cleared:

VALUEOFF NUMERIC 12 

COMBOBOX Part Type

The COMBOBOX part type accepts the same options as EDITTEXT, with the addition of the following option.

Option Description
SUGGESTIONS A list of suggestions to be placed in the drop-down list. The list must end with END SUGGESTIONS. Suggestions are separated with spaces and can be enclosed within double quotation marks. A suggestion that includes white space must be delimited with quotation marks, as illustrated by "New York" in the following example:

SUGGESTIONS
Alaska Alabama Mississippi "New York"
END SUGGESTIONS

DROPDOWNLIST Part Type

The DROPDOWNLIST part type accepts the following options.

Option Description
ITEMLIST A list of the items in the drop-down list. For more information, see ITEMLIST.
REQUIRED Specifies that the Group Policy snap-in will not allow a policy containing this part to be enabled unless a value has been provided for the part.

EDITTEXT Part Type

The EDITTEXT part type accepts the following options.

Option Description
DEFAULT value Specifies the initial string to place in the text box. If this option is not specified, the text box is initially empty.
MAXLEN value Specifies the maximum length of a string. The string in the text box is limited to this length.
REQUIRED Specifies that the Group Policy snap-in will not allow a policy containing this part to be enabled, unless a value has been provided for this part.
OEMCONVERT Sets the ES_OEMCONVERT style in the text box so that typed text is mapped from ANSI to OEM and back to ANSI.
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.

LISTBOX Part Type

The LISTBOX part type accepts the following options.

Option Description
ADDITIVE By default, the content of list boxes will override the values set in the registry. If this option is specified, existing values are not deleted, and the values set in the list box will be in addition to whatever values exist in the target registry.
EXPLICITVALUE This option makes the user specify not only the value data, but the value name as well. The list box will show two columns for each item, one for the name and one for the data. This option cannot be used with the VALUEPREFIX option.
VALUEPREFIX prefix The prefix specified is used in determining value names. If a prefix is specified, the prefix and an incremented integer will be used instead of the default value naming scheme described previously. For example, a prefix of SomeName will generate the value names SomeName1, SomeName2, and so on. The prefix can be empty (""), which will cause the value names to be "1", "2", and so on.

The VALUENAME option cannot be used with the LISTBOX part type, because there is no single value name associated with this type. By default, only one column appears in the list box, and for each entry a value is created whose name and value are the same.

NUMERIC Part Type

The NUMERIC part type accepts the following options.

Option Description
DEFAULT value Specifies the initial numeric value for the text box. If this option is not specified, the text box 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 policy editor will not allow a policy containing this part to be enabled unless a value has been provided for this part.
SPIN value Specifies increments to use for the spin control. SPIN 0 removes the spin control. SPIN 1 is the default.
TXTCONVERT Writes values as REG_SZ strings ("1," "2," or "128") rather than as binary values.

TEXT Part Type

The TEXT part type accepts no type-specific data. This part type is used to display a descriptive message.

See Also

Group Policy Overview, Group Policy File Formats