Tuesday, May 24, 2016

Exchange Online LitigationHold with Power Shell

Place a mailbox on Litigation hold to reserve all mailbox content, including deleted items and original versions of modified items. If you have enabled user’s archive mailbox is also placed on hold. Deleted and modified items are preserved for a given period.

 How Litigation Hold Works

  • When a mailbox is placed on Litigation Hold, items in the purges sub-folder are preserved for the hold duration specified by Litigation hold.
  • Hold duration is calculated from the original date an item was received or created & defines how long items in the purges sub-folder are held.
  • When the litigation hold duration expires for an item in the purges sub-folder, the items marked permanent deletion and will be purged from Exchange.

Power Shell to Manage the LitigationHold

Connect Office 365 with using following cmdlet


$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

Assign the Litigation Hold to specific Office 365 mailbox

Set-Mailbox –Identity “Mailbox Name” –LitigationholdEnabled $True

Set-Mailbox –Identity “Dsingh” –LitigationHoldEnabled $True


Define the time range

Set-Mailbox –identity “Mailbox” –LitigationHoldEnabled $True –LitigationHoldDuration

Set-Mailbox –identity “Dsingh” –LitigationHoldEnabled $True –LitigationHoldDuration 3600

Assign Litigationhold all Online mailbox (Bulk Mode)

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | Set-Mailbox -LitigationHoldEnabled $True


Assign Litigation Hold based on CSV file

Import-CSV  C:\Temp\Litigation.csv | Set-Mailbox -LitigationHoldEnabled $True -LitigationHoldDuration 3600


Enable Litigation Hold Based on department

Get-Recipient -RecipientTypeDetails UserMailbox -ResultSize unlimited -Filter '(Department -eq "Finance")' | Set-Mailbox -LitigationHoldEnabled $True


Assign LitigationHold to Exchange Online recipients that don’t have Litigation Hold


Get-Mailbox | Where {$_.LitigationHoldEnabled -match "False"} | ForEach-Object {$Identity = $_.alias; Set-Mailbox -Identity $Identity -LitigationHoldEnabled $True }


Display information about all of the mailboxes which have Litigation Hold

Get-Mailbox -ResultSize Unlimited | FL LitigationHold*


Display information about specific recipient which his mailbox has Litigation Hold

Get-Mailbox -identity "Dsingh" | FL LitigationHold*


Remove Litigation Hold to specific recipient (Exchange Online mailbox)
Set-Mailbox -LitigationHoldEnabled $False

Set-Mailbox -identity "Dsingh" -LitigationHoldEnabled $False


Remove Litigation Hold to all of the Exchange Online recipients (Bulk mode)

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | Set-Mailbox -LitigationHoldEnabled $False

No comments:

Post a Comment