Commands › Exchange Online

Get-DomainController

Exchange Online ExchangeOnlineManagement Get-*

View a list of domain controllers that exist in your organization.

Quick start script

# Get-DomainController — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Run and inspect
Get-DomainController -GlobalCatalog <SwitchParameter> | Format-List

# 3. Export for evidence / drift tracking
Get-DomainController | Export-Clixml .\DomainController-$(Get-Date -Format yyyyMMdd).xml

Syntax — 2 parameter sets

GlobalCatalog

Get-DomainController [-GlobalCatalog]
 [-Forest <Fqdn>]
 [-Credential <NetworkCredential>]
 [<CommonParameters>]

DomainController

Get-DomainController [-DomainName <Fqdn>]
 [-Credential <NetworkCredential>]
 [<CommonParameters>]

Parameters (4)

ParameterTypeRequiredWhat it controls
-GlobalCatalog SwitchParameter yes The GlobalCatalog switch specifies whether the command should return a list of global catalog servers. You don't need to specify a value with this switch.
-Credential NetworkCredential The Credential parameter specifies the username and password that's used to run this command. Typically, you use this parameter in scripts or when you need to provide different credentials that have the required permissions.
-DomainName Fqdn The DomainName parameter specifies the fully qualified domain name (FQDN) of the domain for which you want to return a list of domain controllers.
-Forest Fqdn The Forest parameter specifies the FQDN of the root domain of the forest for which you want to return a list of domain controllers.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.