Commands › Exchange Online

Enable-MailboxQuarantine

Exchange Online ExchangeOnlineManagement Enable-*

Quarantine mailboxes that affect the availability of the mailbox database.

Quick start script

# Enable-MailboxQuarantine — 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-MailboxQuarantine
$before | Format-List

# 3. Make the change (dry run first)
Enable-MailboxQuarantine -Identity <GeneralMailboxIdParameter> -Database <DatabaseIdParameter> -StoreMailboxIdentity <StoreMailboxIdParameter> -WhatIf
Enable-MailboxQuarantine -Identity <GeneralMailboxIdParameter> -Database <DatabaseIdParameter> -StoreMailboxIdentity <StoreMailboxIdParameter>

# 4. Verify and diff
$after = Get-MailboxQuarantine
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax — 3 parameter sets

MailboxIdentity

Enable-MailboxQuarantine [-Identity] <GeneralMailboxIdParameter>
 [-AllowMigration]
 [-Confirm]
 [-Duration <EnhancedTimeSpan>]
 [-WhatIf]
 [<CommonParameters>]

MailboxOrMailUserIdentity

Enable-MailboxQuarantine [-Identity] <GeneralMailboxOrMailUserIdParameter>
 [-QuarantineReason <String>]
 [-AllowMigration]
 [-Confirm]
 [-Duration <EnhancedTimeSpan>]
 [-WhatIf]
 [<CommonParameters>]

StoreMailboxIdentity

Enable-MailboxQuarantine -Database <DatabaseIdParameter> -StoreMailboxIdentity <StoreMailboxIdParameter>
 [-QuarantineReason <String>]
 [-AllowMigration]
 [-Confirm]
 [-Duration <EnhancedTimeSpan>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-Identity GeneralMailboxIdParameter yes The Identity parameter specifies the mailbox that you want to quarantine. You can use any value that uniquely identifies the mailbox. For example:
-Database DatabaseIdParameter yes The Database parameter specifies the database that contains the mailboxes you want to quarantine. You can use any value that uniquely identifies the database. For example:
-StoreMailboxIdentity StoreMailboxIdParameter yes The StoreMailboxIdentity parameter specifies the mailbox that you want to quarantine when you use the Database parameter.
-AllowMigration SwitchParameter The AllowMigration switch allows a quarantined mailbox to be moved to another mailbox database or to the cloud. You don't need to specify a value with this switch.
-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.
-Duration EnhancedTimeSpan The Duration parameter specifies how long the mailbox should remain quarantined. The default value is 24 hours.
-QuarantineReason String The QuarantineReason parameter specifies why you quarantined the mailbox. The maximum length is 255 characters. If the value contains spaces, enclose the value in quotation marks.
-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.