DomainController.FindOne Method

Definition

Finds a single domain controller.

Overloads

FindOne(DirectoryContext)

Finds a single domain controller in the specified context.

FindOne(DirectoryContext, LocatorOptions)

Finds a single domain controller in the specified context, allowing for additional search options.

FindOne(DirectoryContext, String)

Finds a single domain controller in the specified context and site.

FindOne(DirectoryContext, String, LocatorOptions)

Finds a single domain controller in the specified context and site, allowing for additional search options.

FindOne(DirectoryContext)

Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs

Finds a single domain controller in the specified context.

public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context);

Parameters

context
DirectoryContext

A DirectoryContext object that contains the target and credentials to use for the search.

Returns

A DomainController object that represents the domain controller that was found by the search.

Exceptions

No domain controller was found.

context is null.

See also

Applies to

.NET 9 (package-provided) والإصدارات الأخرى
منتج الإصدارات
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

FindOne(DirectoryContext, LocatorOptions)

Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs

Finds a single domain controller in the specified context, allowing for additional search options.

public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context, System.DirectoryServices.ActiveDirectory.LocatorOptions flag);

Parameters

context
DirectoryContext

A DirectoryContext object that contains the target and credentials to use for the search.

flag
LocatorOptions

A combination of one or more of the LocatorOptions members that defines the type of domain controller to find.

Returns

A DomainController object that represents the domain controller that was found by the search.

Exceptions

No domain controller was found.

context or flag is not valid.

context is null.

See also

Applies to

.NET 9 (package-provided) والإصدارات الأخرى
منتج الإصدارات
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

FindOne(DirectoryContext, String)

Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs

Finds a single domain controller in the specified context and site.

public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context, string siteName);

Parameters

context
DirectoryContext

A DirectoryContext object that contains the target and credentials to use for the search.

siteName
String

The name of the site to search for a domain controller.

Returns

A DomainController object that represents the domain controller that was found by the search.

Exceptions

No domain controller was found.

context or siteName is not valid.

context or siteName is null.

See also

Applies to

.NET 9 (package-provided) والإصدارات الأخرى
منتج الإصدارات
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

FindOne(DirectoryContext, String, LocatorOptions)

Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs
Source:
DomainController.cs

Finds a single domain controller in the specified context and site, allowing for additional search options.

public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context, string siteName, System.DirectoryServices.ActiveDirectory.LocatorOptions flag);

Parameters

context
DirectoryContext

A DirectoryContext object that contains the target and credentials to use for the search.

siteName
String

The name of the site to search for a domain controller.

flag
LocatorOptions

A combination of one or more of the LocatorOptions members that defines the type of domain controller to find.

Returns

A DomainController object that represents the domain controller that was found by the search.

Exceptions

No domain controller was found.

context, siteName, or flag is not valid.

context or siteName is null.

See also

Applies to

.NET 9 (package-provided) والإصدارات الأخرى
منتج الإصدارات
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9