Platform SDK: Group Policy

IGroupPolicyObject::New

Creates a new GPO in the Active Directory with the specified display name. Opens the GPO using OpenDSGPO.

HRESULT New(
  LPOLESTR pszDomain,
  LPOLESTR pszName,
  DWORD dwFlags
);

Parameters

pszDomain
Specifies the Active Directory path of the object to create. If the path specifies a domain controller, the GPO is created on that DC. Otherwise, the system will select a DC on the caller's behalf.
pszName
Specifies the display name of the object to create.
dwFlags
Specifies whether the registry information should be loaded or not. This parameter can be one of the following values.
Value Meaning
GPO_OPEN_LOAD_REGISTRY Load the registry information.
GPO_OPEN_READ_ONLY Open the GPO in read-only mode.

Return Values

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

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Gpedit.h.

See Also

Group Policy Overview, Group Policy Interfaces, IGroupPolicyObject