How to Enable Litigation Hold on Multiple Exchange Online Mailboxes Using PowerShell

In this blog post, I’ll show how to enable Litigation Hold on multiple mailboxes hosted on Exchange Online using Exchange PowerShell.

Because Exchange Online doesn’t offer data restoration in case you need to recover a deleted item you’ve deleted a few years ago.

When litigation hold enabled on a mailbox, nothing gets deleted from the mailbox and all deleted items become hidden but still exist in the mailbox,

To get started, I have created a.CSV file with the format below.

Upn
User.01@domian.local
User.02@domian.local

To run the script, connect to Exchange Online and run the script.

$MailData = import-csv .\musers.csv
foreach($m in $MailData)
{
Get-Mailbox $m.upn
Set-Mailbox $m.upn -LitigationHoldEnabled $true -LitigationHoldDuration 1000
Get-Mailbox $m.upn | select litig*
}

Leave a Reply

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