Domain.FindDomainController Method

Definition

Finds any domain controller in this domain.

Overloads

FindDomainController()

Finds any domain controller in this domain.

FindDomainController(LocatorOptions)

Finds a domain controller in this domain that meets the specified criteria.

FindDomainController(String)

Finds a domain controller in this domain and in the specified site.

FindDomainController(String, LocatorOptions)

Finds a domain controller in this domain and in the specified site that meets the specified criteria.

FindDomainController()

Finds any domain controller in this domain.

public:
 System::DirectoryServices::ActiveDirectory::DomainController ^ FindDomainController();
public System.DirectoryServices.ActiveDirectory.DomainController FindDomainController ();
member this.FindDomainController : unit -> System.DirectoryServices.ActiveDirectory.DomainController
Public Function FindDomainController () As DomainController

Returns

A DomainController that represents the domain controller that is found by this method.

Exceptions

A domain controller cannot be located.

A call to the underlying directory service resulted in an error.

The object has been disposed.

Remarks

This method finds any domain controller in the domain. There is no guarantee that the same domain controller will be found by another call to this method.

See also

Applies to

FindDomainController(LocatorOptions)

Finds a domain controller in this domain that meets the specified criteria.

public:
 System::DirectoryServices::ActiveDirectory::DomainController ^ FindDomainController(System::DirectoryServices::ActiveDirectory::LocatorOptions flag);
public System.DirectoryServices.ActiveDirectory.DomainController FindDomainController (System.DirectoryServices.ActiveDirectory.LocatorOptions flag);
member this.FindDomainController : System.DirectoryServices.ActiveDirectory.LocatorOptions -> System.DirectoryServices.ActiveDirectory.DomainController
Public Function FindDomainController (flag As LocatorOptions) As DomainController

Parameters

flag
LocatorOptions

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

Returns

A DomainController that represents the domain controller that is found by this method.

Exceptions

A domain controller cannot be located.

A call to the underlying directory service resulted in an error.

The flag parameter contains an invalid value.

The object has been disposed.

See also

Applies to

FindDomainController(String)

Finds a domain controller in this domain and in the specified site.

public:
 System::DirectoryServices::ActiveDirectory::DomainController ^ FindDomainController(System::String ^ siteName);
public System.DirectoryServices.ActiveDirectory.DomainController FindDomainController (string siteName);
member this.FindDomainController : string -> System.DirectoryServices.ActiveDirectory.DomainController
Public Function FindDomainController (siteName As String) As DomainController

Parameters

siteName
String

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

Returns

A DomainController object that represents the domain controller that is found by this method.

Exceptions

A domain controller cannot be located.

A call to the underlying directory service resulted in an error.

siteName is an empty string.

siteName is null.

The object has been disposed.

See also

Applies to

FindDomainController(String, LocatorOptions)

Finds a domain controller in this domain and in the specified site that meets the specified criteria.

public:
 System::DirectoryServices::ActiveDirectory::DomainController ^ FindDomainController(System::String ^ siteName, System::DirectoryServices::ActiveDirectory::LocatorOptions flag);
public System.DirectoryServices.ActiveDirectory.DomainController FindDomainController (string siteName, System.DirectoryServices.ActiveDirectory.LocatorOptions flag);
member this.FindDomainController : string * System.DirectoryServices.ActiveDirectory.LocatorOptions -> System.DirectoryServices.ActiveDirectory.DomainController
Public Function FindDomainController (siteName As String, flag As LocatorOptions) As DomainController

Parameters

siteName
String

The name of the site to search for the 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 is found by this method.

Exceptions

A domain controller cannot be located.

A call to the underlying directory service resulted in an error.

This exception will occur for any of the following reasons.

  • siteName is an empty string.

  • flag contains an invalid value.

siteName is null.

The object has been disposed.

See also

Applies to