best business builder

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 https://ps.outlook.com/powershell-liveid `
-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


Got a project that needs expert IT support?

From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.

Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!

CONTACT US NOW
one click social media designs