Get-ADDomainController
Use Get-ADDomainController to retrieve domain controllers in a domain or forest, with their roles, site and status.
Documentation: Microsoft Learn — Get-ADDomainController
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-ADDomainController [-Identity] <ADDomainController> [-Filter <String>] [-Discover] [-Service <ADDiscoverableService[]>] [-DomainName <String>] [-SiteName <String>] [-Server <String>] [<CommonParameters>]- Stage 1Get-ADDomainController
-Identity -Filter -Discover -Service -DomainName -SiteName -Server
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Get-ADDomainController -Filter *
Show reference output
Sample output · fictional data, shaped like the real thing
Name Site IsGlobalCatalog IsReadOnly ---- ---- --------------- ---------- DC01 Default-First-Site-Name True False DC02 Default-First-Site-Name True False
Get-ADDomainController -Filter * (2)
Show reference output
Sample output · fictional data, shaped like the real thing
Name OperationMasterRoles
---- --------------------
DC01 {PDCEmulator, RIDMaster, SchemaMaster, DomainNamingMaster}
DC02 {InfrastructureMaster}Get-ADDomainController -Discover
Show reference output
Sample output · fictional data, shaped like the real thing
HostName Site IPv4Address IsGlobalCatalog -------- ---- ----------- --------------- DC01.corp.local Default-Site 10.20.30.10 True DC02.corp.local Default-Site 10.20.30.11 True
Parameters
Parameter definitions:
-Identity-Filter-Discover-Service-DomainName-SiteName-Server
Practical use and troubleshooting
Practical scenario: Use Get-ADDomainController when you need to retrieve domain controllers in a domain or forest, with their roles, site and status. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Discovery returning an unexpected site needs checking the client's subnet-to-site mapping. Verify site information before selecting a controller for a locality-sensitive operation. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-ADReplicationPartnerMetadata. Get-ADDomainController discovers domain controllers; Get-ADReplicationPartnerMetadata examines replication partners. Finding a controller does not establish that its directory partitions are up to date. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Get-ADDomainController Use Get-ADDomainController to retrieve domain controllers in a domain or forest, with their roles, site and status.
Next: Get-ADComputer