Commands › Exchange Online

Set-ADServerSettings

Exchange Online ExchangeOnlineManagement Set-*

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)

ParameterTypeRequiredWhat it controls
-PreferredServer Fqdn yes The PreferredServer parameter specifies the FQDN of the domain controller to be used for this session.
-RunspaceServerSettings RunspaceServerSettingsPresentationObject yes The RunspaceServerSettings parameter specifies whether to pass an entire configuration object to the command to be processed. This parameter is useful in scripts where an entire object must be passed to the command.
-ConfigurationDomainController Fqdn The ConfigurationDomainController parameter specifies the fully qualified domain name (FQDN) of the configuration domain controller to be used for reading Exchange configuration information in this session.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-PreferredGlobalCatalog Fqdn The PreferredGlobalCatalog parameter specifies the FQDN of the global catalog server to be used for reading recipient information in this session.
-RecipientViewRoot String The RecipientViewRoot parameter specifies the organizational unit (OU) to include in the recipient scope for this session. When you specify a recipient scope with this parameter, only the recipients included in the...
-SetPreferredDomainControllers MultiValuedProperty The SetPreferredDomainControllers parameter specifies the list of domain controllers used to read information from Active Directory in this session. You must specify the FQDN of the domain controllers. Separate...
-ViewEntireForest Boolean The ViewEntireForest parameter specifies whether all the objects in the forest are viewed and managed in this session. Valid values are $true and $false.
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

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