PreferenceExtension Constructor (DirectoryContext, String, Boolean)
Initializes a new instance of the PreferenceExtension class by using the specified DirectoryContext, the display name of the Group Policy object (GPO), 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,
string gpoDisplayName,
bool isComputerConfiguration
)
protected:
PreferenceExtension(
DirectoryContext^ context,
String^ gpoDisplayName,
bool isComputerConfiguration
)
new :
context:DirectoryContext *
gpoDisplayName:string *
isComputerConfiguration:bool -> PreferenceExtension
Protected Sub New (
context As DirectoryContext,
gpoDisplayName As String,
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.
gpoDisplayName
Type: System.StringThe display name of the GPO to edit.
isComputerConfiguration
Type: System.Booleantrue to edit Computer Configuration; false to edit User Configuration.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The context parameter or the gpoDisplayName parameter is null. |
ArgumentOutOfRangeException | context does not specify a directory context with a type of DirectoryServer or Domain. |
ActiveDirectoryObjectNotFoundException | The GPO is not found. |
MultipleGroupPolicyObjectsFoundException | Multiple GPOs with the specified display name exist in the domain. |
See Also
PreferenceExtension Overload
PreferenceExtension Class
Microsoft.GroupPolicy Namespace
Return to top