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,

Get Started

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




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*