GroupPolicyObject.CreateNew Method (String, String, Boolean, Boolean)


Creates a new Group Policy object (GPO) with the specified display name by using the Active Directory path to a domain or a domain controller.

Namespace:   Microsoft.GroupPolicy
Assembly:  Microsoft.GroupPolicy.Management.Interop (in Microsoft.GroupPolicy.Management.Interop.dll)


public void CreateNew(
    string domainOrServerPath,
    string gpoDisplayName,
    bool readOnly,
    bool loadRegistry
void CreateNew(
    String^ domainOrServerPath,
    String^ gpoDisplayName,
    bool readOnly,
    bool loadRegistry
member CreateNew : 
        domainOrServerPath:string *
        gpoDisplayName:string *
        readOnly:bool *
        loadRegistry:bool -> unit
Public Sub CreateNew (
    domainOrServerPath As String,
    gpoDisplayName As String,
    readOnly As Boolean,
    loadRegistry As Boolean


  • domainOrServerPath
    Type: System.String

    The Active Directory path of the domain or the domain controller in which to create the GPO. If a domain controller is specified, the GPO is created on that domain controller. If a domain is specified, the system selects a domain controller on the caller's behalf.

  • gpoDisplayName
    Type: System.String

    The display name for the new GPO.

  • readOnly
    Type: System.Boolean

    true to open the GPO in read-only mode; otherwise, false.

  • loadRegistry
    Type: System.Boolean

    true to load the registry; otherwise, false.


Exception Condition

The domainOrServerPath parameter or the gpoDisplayName parameter is an empty string (“”).


The domainOrServerPath parameter or the gpoDisplayName parameter is null.


The GroupPolicyObject is disposed.


The new GPO is opened according to the value of the readOnly and loadRegistry parameters.

To open an existing GPO, you can use one of the overloaded OpenDSGpo methods.

See Also

CreateNew Overload
GroupPolicyObject Class
Microsoft.GroupPolicy Namespace

Return to top