Get-ADDomainController

Gets the domain controller of the current computer's domain, or for a specific domain.

Syntax

Get-ADDomainController [[-Domain] <String>] [<CommonParameters>]

Description

When working with Active Directory, it's important to have the hostname of the domain controller you need to work with. This function will find the domain controller for the domain of the current computer or the domain controller for a given domain.

Parameters

Name Type Description Required? Pipeline Input Default Value
Domain String

The domain whose domain controller to get. If not given, gets the current computer's domain controller.

false false

EXAMPLE 1

Get-ADDomainController

Returns the domain controller for the current computer's domain.
Approximately equivialent to the hostname given in the LOGONSERVER environment variable.

EXAMPLE 2

Get-ADDomainController -Domain MYDOMAIN

Returns the domain controller for the MYDOMAIN domain.