共用方式為


Finding a Domain Controller for a Domain

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to find a domain controller for a domain in Active Directory Domain Services (AD DS).

Examples

The following example demonstrates how to find a domain controller for the Fabrikam.com domain:

Get-ADDomainController -Discover -DomainName fabrikam.com

The following example demonstrates how to find all domain controllers for the domain you are currently logged on to:

Get-ADDomainController –filter *

The following example demonstrates how to return a list of all domain controllers that are running Windows Server 2008 or later in the Fabrikam.com domain:

get-addomaincontroller -Filter {operatingsystemversion -ge “6.0”} -server fabrikam.com

The following example demonstrates how to find all domain controllers from each domain in the forest that are running Windows Server 2008 or later:

(get-adforest).domains | foreach {get-addomaincontroller -discover –domainname $_} | foreach {get-addomaincontroller –filter {operatingsystemversion –ge "6.0" –server $_} 

Additional information

In addition to the standard Lightweight Directory Access Protocol (LDAP) attributes, you can retrieve the following extended properties of the Get-ADDomainController cmdlet by using the -Properties parameter:

  • ComputerObjectDN

  • Domain

  • Enabled

  • Forest

  • IsGlobalCatalog

  • IsReadOnly

  • OperatingSystem

  • OperatingSystemHotfix

  • OperatingSystemServicePack

  • OperatingSystemVersion

  • ServerObjectGuid

For a full explanation of the parameters that you can pass to Get-ADDomainController, at the Active Directory module command prompt, type Get-Help Get-ADDomainController –detailed, and then press ENTER.

Change History

Date Revision

Aug 20, 2012

Corrected the example and added new examples.