Edit

Share via


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);
public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context);
static member FindOne : System.DirectoryServices.ActiveDirectory.DirectoryContext -> System.DirectoryServices.ActiveDirectory.DomainController
Public Shared Function FindOne (context As DirectoryContext) As DomainController

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

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);
public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context, System.DirectoryServices.ActiveDirectory.LocatorOptions flag);
static member FindOne : System.DirectoryServices.ActiveDirectory.DirectoryContext * System.DirectoryServices.ActiveDirectory.LocatorOptions -> System.DirectoryServices.ActiveDirectory.DomainController
Public Shared Function FindOne (context As DirectoryContext, flag As LocatorOptions) As DomainController

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

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, System::String ^ siteName);
public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context, string siteName);
static member FindOne : System.DirectoryServices.ActiveDirectory.DirectoryContext * string -> System.DirectoryServices.ActiveDirectory.DomainController
Public Shared Function FindOne (context As DirectoryContext, siteName As String) As DomainController

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

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, System::String ^ siteName, System::DirectoryServices::ActiveDirectory::LocatorOptions flag);
public static System.DirectoryServices.ActiveDirectory.DomainController FindOne (System.DirectoryServices.ActiveDirectory.DirectoryContext context, string siteName, System.DirectoryServices.ActiveDirectory.LocatorOptions flag);
static member FindOne : System.DirectoryServices.ActiveDirectory.DirectoryContext * string * System.DirectoryServices.ActiveDirectory.LocatorOptions -> System.DirectoryServices.ActiveDirectory.DomainController
Public Shared Function FindOne (context As DirectoryContext, siteName As String, flag As LocatorOptions) As DomainController

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