Commands › Exchange Online

Disconnect-ExchangeOnline

Exchange Online ExchangeOnlineManagement Disconnect-*

For more information, see About the Exchange Online PowerShell module. Use the Disconnect-ExchangeOnline cmdlet in the Exchange Online PowerShell module to disconnect the connections that you created using the Connect-ExchangeOnline or Connect-IPPSSession cmdlets.

Quick start script

# Disconnect-ExchangeOnline — 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
Disconnect-ExchangeOnline -ConnectionId <String[]> -ModulePrefix <String[]> | Format-List

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

Syntax — 3 parameter sets

DefaultParameterSet (Default)

Disconnect-ExchangeOnline
 [-Confirm]
 [-WhatIf]
 [<CommonParameters>]

ConnectionId

Disconnect-ExchangeOnline -ConnectionId <String[]>
 [-Confirm]
 [-WhatIf]
 [<CommonParameters>]

ModulePrefix

Disconnect-ExchangeOnline -ModulePrefix <String[]>
 [-Confirm]
 [-WhatIf]
 [<CommonParameters>]

Parameters (4)

ParameterTypeRequiredWhat it controls
-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.
-ConnectionId String[] yes **Note**: This parameter is available in module version 3.2.0-Preview2 or later.
-ModulePrefix String[] yes **Note**: This parameter is available in module version 3.2.0-Preview2 or later.
-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.