Report domain controllers
Documentation: Microsoft Learn
List AD domain controllers with their sites, IPv4 addresses, operating systems, and global-catalog status using Get-ADDomainController.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-ADDomainController -Filter * | Select-Object HostName,Site,IPv4Address,OperatingSystem,IsGlobalCatalog- Stage 1Get-ADDomainController
-Filter - Stage 2Select-Object
Positional values or no named parameters
How it works
Get-ADDomainController with -Filter * enumerates the controllers, and the projection reports each host name with its AD site, IPv4 address, operating system version, and whether that server holds a global catalog.
Adapting it
Swap -Filter * for -Discover -Service PrimaryDC when the only question is which server currently answers as PDC emulator for the domain the session is bound to.
Requirements
ActiveDirectory module.
If the result is unexpected
A domain controller is missing from the inventory.
The query may target a different domain or use credentials that cannot discover the intended controllers.
- Confirm the domain and query a known controller directly before comparing the full list.
Validate the result
The inventory matches the selected domain and identifies the server used for discovery.
Keep the check reliable
Make domain and server parameters explicit in recurring inventory jobs.