PreferenceExtension Constructor (DirectoryContext, Guid, Boolean)
Initializes a new instance of the PreferenceExtension class by using the specified DirectoryContext, the specified Group Policy object (GPO) ID (GUID), and a value that specifies whether to edit Computer Configuration or User Configuration.
Namespace: Microsoft.GroupPolicy
Assembly: Microsoft.GroupPolicy.Management (in Microsoft.GroupPolicy.Management.dll)
Syntax
protected PreferenceExtension(
DirectoryContext context,
Guid gpoId,
bool isComputerConfiguration
)
protected:
PreferenceExtension(
DirectoryContext^ context,
Guid gpoId,
bool isComputerConfiguration
)
new :
context:DirectoryContext *
gpoId:Guid *
isComputerConfiguration:bool -> PreferenceExtension
Protected Sub New (
context As DirectoryContext,
gpoId As Guid,
isComputerConfiguration As Boolean
)
Parameters
context
Type: System.DirectoryServices.ActiveDirectory.DirectoryContextA DirectoryContext that identifies the context with which the directory is accessed. This includes the directory, the domain, and the credentials that are used to access the directory.
gpoId
Type: System.GuidThe GUID of the GPO to edit.
isComputerConfiguration
Type: System.Booleantrue to edit Computer Configuration; false to edit User Configuration.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | context is null. |
ArgumentOutOfRangeException | context does not specify a directory context with a type of DirectoryServeror Domain. |
ActiveDirectoryObjectNotFoundException | The GPO is not found. |
See Also
PreferenceExtension Overload
PreferenceExtension Class
Microsoft.GroupPolicy Namespace
Return to top