customer relationships

Enable Litigation Hold for all Mailboxes in Office 365

There’s no built-in feature at this time to enable litigation hold for all mailboxes in Exchange Online, but some organisations have this as a requirement. Here’s a script that can be run ad-hoc to enable litigation hold for all mailboxes. When prompted, enter your Exchange Online credentials.


# Connect to Exchange Online
$exo = New-PSSession -ConfigurationName Microsoft.Exchange `
-ConnectionUri `
-Authentication Basic `
-AllowRedirection `
-Credential $(Get-credential)

Import-PSSession $exo

# Get all mailboxes that do not have litigation hold enabled
$mailboxes = Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq “UserMailbox”} |
Where {$_.LitigationHoldEnabled -ne $true}

# Enable litigation hold
$mailboxes | Set-Mailbox -LitigationHoldEnabled $true

Remove-PSSession $exo

one click social media designs

Leave a Reply

Your email address will not be published. Required fields are marked *