PowerShell Logo Small

Get-ADDomainController



This is the built-in help made by Microsoft for the command 'Get-ADDomainController', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets one or more Active Directory domain controllers based on discoverable services criteria, search parameters or by providing a domain controller identifier, such as the NetBIOS name.

SYNTAX


Get-ADDomainController [[-Identity] <ADDomainController>] [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Server <String>] [<CommonParameters>]
Get-ADDomainController [-AuthType {Negotiate | Basic}] [-AvoidSelf] [-DomainName <String>] [-ForceDiscover] [-MinimumDirectoryServiceVersion {Windows2000 | Windows2008 |
Windows2012 | Windows2012R2}] [-NextClosestSite] [-Service {ADWS | GlobalCatalog | KDC | PrimaryDC | ReliableTimeService | TimeService}] [-SiteName <String>] [-Writable]
-Discover [<CommonParameters>]
Get-ADDomainController [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Server <String>] -Filter <String> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-ADDomainController cmdlet gets the domain controllers specified by the parameters. You can get domain controllers by setting the Identity, Filter or Discover
parameters.


The Identity parameter specifies the domain controller to get. You can identify a domain controller by its GUID, IPV4Address, global IPV6Address, or DNS host name. You can
also identify a domain controller by the name of the server object that represents the domain controller, the Distinguished Name (DN) of the NTDS settings object or the
server object, the GUID of the NTDS settings object or the server object under the configuration partition, or the DN of the computer object that represents the domain
controller. You can also set the Identity parameter to a domain controller object variable, such as $<localDomainControllerObject>, or pass a domain controller object
through the pipeline to the Identity parameter.


To search for and retrieve more than one domain controller, use the Filter parameter. The Filter parameter uses the PowerShell Expression Language to write query strings for
Active Directory. PowerShell Expression Language syntax provides rich type conversion support for value types received by the Filter parameter. For more information about
the Filter parameter syntax, type Get-Help about_ActiveDirectory_Filter. You cannot use an LDAP query string with this cmdlet.


To get a domain controller by using the discovery mechanism of DCLocator, use the Discover parameter. You can provide search criteria by setting parameters such as Service,
SiteName, DomainName, NextClosestSite, AvoidSelf, and ForceDiscover.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291026
Add-ADDomainControllerPasswordReplicationPolicy
Get-ADDomainControllerPasswordReplicationPolicy
Remove-ADDomainControllerPasswordReplicationPolicy

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Get-ADDomainController -Discover -Site "Default-First-Site-Name"



This command gets one available DC in the site specified by the Site parameter. The command uses Discovery.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-ADDomainController -Discover -Site "Default-First-Site-Name" -ForceDiscover



This command force discovers or finds one available DC in the site specified by the Site parameter.




-------------------------- EXAMPLE 3 --------------------------

PS C:\>Get-ADDomainController -Discover -Service "GlobalCatalog"



This command gets a global catalog in the current forest using Discovery.




-------------------------- EXAMPLE 4 --------------------------

PS C:\>Get-ADDomainController -Discover -Service 2



This command gets a global catalog in the current forest using Discovery.




-------------------------- EXAMPLE 5 --------------------------

PS C:\>Get-ADDomainController -Discover



This command gets one available DC in the current domain using Discovery.




-------------------------- EXAMPLE 6 --------------------------

PS C:\>Get-ADDomainController -Discover -Domain "fabrikam.com"



This command gets one available DC in a given domain using Discovery.




-------------------------- EXAMPLE 7 --------------------------

PS C:\>Get-ADDomainController -Discover -Domain "corp.contoso.com" -Service "PrimaryDC","TimeService"



This command gets the PDC using Discovery and make sure that is advertising as a time server.




-------------------------- EXAMPLE 8 --------------------------

PS C:\>Get-ADDomainController -Identity "PDC-01"



This command gets a domain controller using its NetBIOS name.




-------------------------- EXAMPLE 9 --------------------------

PS C:\>Get-ADDomainController -Identity "TK5-CORP-DC-10.fabrikam.com" -Server "fabrikam.com" -Credential "corp\administrator"



This command gets a domain controller using its DNS host name, in the domain specified by the Site parameter, specified in Server parameter, and specifying administrator
credentials.




-------------------------- EXAMPLE 10 --------------------------

PS C:\>Get-ADDomainController -Identity "168.54.62.57"



This command get a domain controller using its IP address.




-------------------------- EXAMPLE 11 --------------------------

PS C:\>Get-ADDomainController -Filter { isGlobalCatalog -eq $true -and Site -eq "Default-First-Site-Name" }



This command gets all global catalogs in the site specified by the Site parameter.




-------------------------- EXAMPLE 12 --------------------------

PS C:\>Get-ADDomainController -Server "research.fabrikam.com" -Filter { isGlobalCatalog -eq $true -and isReadOnly -eq $true }



This command gets all ROGCs in the child domain to which the client is connected.




-------------------------- EXAMPLE 13 --------------------------

PS C:\>Get-ADDomainController



This command gets the domain controller in the user's current session. This is the domain controller used as a default Server in the context of an AD Provider. Using this
cmdlet in this way will let you know which Server is being used by default.




-------------------------- EXAMPLE 14 --------------------------

PS C:\>$allDCs = (Get-ADForest).Domains | %{ Get-ADDomainController -Filter * -Server $_ }



This command gets a list of all of the domain controllers for all the domains within a forest.