Commands › Exchange Online
Set-ADServerSettings
Manage the Active Directory Domain Services (AD DS) environment in the current Exchange Management Shell session. The Set-ADServerSettings cmdlet replaces the AdminSessionADSettings session variable that was used in Exchange Server 2007.
Quick start script
# Set-ADServerSettings — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-ADServerSettings
$before | Format-List
# 3. Make the change (dry run first)
Set-ADServerSettings -PreferredServer <Fqdn> -RunspaceServerSettings <RunspaceServerSettingsPresentationObject> -WhatIf
Set-ADServerSettings -PreferredServer <Fqdn> -RunspaceServerSettings <RunspaceServerSettingsPresentationObject>
# 4. Verify and diff
$after = Get-ADServerSettings
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 3 parameter sets
Instance
Set-ADServerSettings -RunspaceServerSettings <RunspaceServerSettingsPresentationObject>
[-Confirm]
[-WhatIf]
[<CommonParameters>]
FullParams
Set-ADServerSettings [-ConfigurationDomainController <Fqdn>]
[-PreferredGlobalCatalog <Fqdn>]
[-RecipientViewRoot <String>]
[-SetPreferredDomainControllers <MultiValuedProperty>]
[-ViewEntireForest <Boolean>]
[-Confirm]
[-WhatIf]
[<CommonParameters>]
SingleDC
Set-ADServerSettings [[-PreferredServer] <Fqdn>]
[-RecipientViewRoot <String>]
[-ViewEntireForest <Boolean>]
[-Confirm]
[-WhatIf]
[<CommonParameters>]
Parameters (9)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.