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

 

Creates a new Group Policy object (GPO) with the specified display name in the specified domain.

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

Syntax

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

Parameters

  • 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.

Exceptions

Exception Condition
ArgumentException

gpoDisplayName is an empty string (“”).

ArgumentNullException

The domain parameter or the gpoDisplayName parameter is null.

ObjectDisposedException

The GroupPolicyObject is disposed.

Remarks

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