Skip to content

Manage Litigation Hold by using PowerShell | Office 365

Litigation Hold is an Exchange server future that enables us to “freeze” all the mail items that were deleted by the user and keep this mail item in a hidden folder that can be accessed by the Exchange administrator. In other words, each of the mail items that was deleted by Intentionally or accidentally by the user can be recovered.

Litigation Hold

The “protection” of deleted mail items will be implemented for all types of mail items such as calendar, mail, etc. By default, the deleted mail items will be saved for an unlimited amount of time.

In a scenario of Office 365 and Exchange Online customer, the ability to use the option of Litigation Hold is available only for Office 365 customers that purchased Exchange Online E3 license or Exchange Online Plan 2.

The current article describes the way that we apply Litigation Hold on Exchange Online mailboxes. In case that you need information regarding the part that relate to “how to recover mail items” from a mailbox with Litigation Hold, you can read the article Using Exchange In-place eDiscovery & Hold for recovering deleted mail items | 6#7.

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands specified in the current article, you will need to Connect to Exchange Online PowerShell.

Start Windows PowerShell as administrator and run the cmdlet Connect-ExchangeOnline.

Connect-ExchangeOnline

1. Assign Litigation Hold

Assign Litigation Hold to single mailbox

PowerShell command syntax:

Set-Mailbox "Identity" -LitigationHoldEnabled $True

PowerShell command example:

Set-Mailbox "John" -LitigationHoldEnabled $True

Assign Litigation Hold to single mailbox and define time range (7 years)

PowerShell command syntax:

Set-Mailbox "Identity" -LitigationHoldEnabled $True -LitigationHoldDuration "time range"

PowerShell command example:

Set-Mailbox "John" -LitigationHoldEnabled $True -LitigationHoldDuration "2555"

Assign Litigation Hold to all mailboxes (Bulk mode)

PowerShell command example:

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

Assign litigation Hold to all mailboxes (Bulk mode) based on department

PowerShell command syntax:

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

PowerShell command example:

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

Assign litigation Hold to all mailboxes that don’t have Litigation Hold

PowerShell command example:

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

2. Display information about Litigation Hold

Display information about single mailbox with Litigation Hold

PowerShell command syntax:

Get-Mailbox "Identity" | FL LitigationHold*

PowerShell command example:

Get-Mailbox "John" | FL LitigationHold*

Display information about all mailboxes with Litigation Hold

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | FL LitigationHold*

Display information about User mailboxes with Litigation Hold using the filter operator

PowerShell command example:

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | FL Name,LitigationHold*

Display information about User mailboxes with Litigation Hold using the Where operator

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | Where {$_.LitigationHoldEnabled -match "True"} | FL Name,LitigationHold*

Display information about User mailboxes without Litigation Hold

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | Where {$_.LitigationHoldEnabled -match "False"} | FL Name,LitigationHold*

Display information about mailboxes with Litigation Hold | Recoverable items folder

PowerShell command example:

Get-Mailbox -ResultSize Unlimited -Filter {LitigationHoldEnabled -eq $true} | Get-MailboxFolderStatistics –FolderScope RecoverableItems | FT Identity,FolderAndSubfolderSize -Auto

3. Remove Litigation Hold

Remove Litigation Hold from single mailbox

PowerShell command syntax:

Set-Mailbox "Identity" -LitigationHoldEnabled $False

PowerShell command example:

Set-Mailbox "John" -LitigationHoldEnabled $False

Remove Litigation Hold from all user mailboxes

PowerShell command example:

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

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

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