IGroupPolicyObject::SetOptions method

The SetOptions method sets the options for the GPO.

Syntax


HRESULT SetOptions(
  [in] DWORD dwOptions,
  [in] DWORD dwMask
);

Parameters

dwOptions [in]

Specifies the new option values. This parameter can be one or more of the following options. For more information, see the following Remarks section.

GPO_OPTION_DISABLE_USER

Disable the user portion of the GPO.

GPO_OPTION_DISABLE_MACHINE

Disable the computer portion of the GPO.

dwMask [in]

Specifies the options to change. This parameter can be one or more of the following options. For more information, see the following Remarks section.

GPO_OPTION_DISABLE_USER

Disable the user portion of the GPO.

GPO_OPTION_DISABLE_MACHINE

Disable the computer portion of the GPO.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the method returns one of the COM error codes defined in the Platform SDK header file WinError.h.

Remarks

Note  A policy refresh will be automatically triggered when the user or computer portion of the local Group Policy object is enabled or disabled using the SetOptions method.
 

To change an option, you must set the appropriate flag in the dwMask parameter. If the flag is set, then the system reads the dwOptions parameter to set the new state. For example, to disable the user portion of a GPO, and leave the computer portion unchanged, call the SetOptions method as follows:


SetOptions(GPO_OPTION_DISABLE_USER, GPO_OPTION_DISABLE_USER)

To enable the user portion and disable the computer portion, call the SetOptions method as follows:


SetOptions(GPO_OPTION_DISABLE_MACHINE, GPO_OPTION_DISABLE_USER | GPO_OPTION_DISABLE_MACHINE)

To retrieve the options for a GPO, you can call the GetOptions method.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Gpedit.h

DLL

Gpedit.dll

IID

IID_IGroupPolicyObject is defined as EA502723-A23D-11d1-A7D3-0000F87571E3

See also

Group Policy Overview
Group Policy Interfaces
IGroupPolicyObject
GetOptions

 

 

Show: