If you need to use Litigation hold, which is a process whereby mail is not actually deleted from the mailbox, the user can delete the mails that go to the recoverable items but within that folder there are lots of subsections as you can see in the diagram below:
When you enable Litigation hold, you need to be aware that when the deleted folder size gets to 100GB then the mailbox will not function correctly as it cannot store anymore data with the Litigation hold enabled, I have covered this here if you are interested.
WARNING : You need to have an Office E3 licensed mailbox for this to work, you cannot enable Litigation hold on unlicensed mailboxes of anything under an E3 license
If you get this error then you do not have a valid license for this operation:
Write-ErrorMessage : Ex163984|Microsoft.Exchange.Management.Tasks.RecipientTaskException|The action 'Set-Mailbox', 'LitigationHoldEnabled', can't be performed on the user '<mailbox>'. Your Microsoft Exchange Online license doesn't permit you to put a litigation hold on this mailbox.
If you get this error then you do not have a valid license for this operation:
Write-ErrorMessage : Ex163984|Microsoft.Exchange.Management.Tasks.RecipientTaskException|The action 'Set-Mailbox', 'LitigationHoldEnabled', can't be performed on the user '<mailbox>'. Your Microsoft Exchange Online license doesn't permit you to put a litigation hold on this mailbox.
Report on the current status
If you wish to get the current status of Litigation hold you can use the commands below:
Check all Enabled mailboxes
Check all Enabled mailboxes
Get-Mailbox -ResultSize Unlimited | where-object {$_.LitigationHoldEnabled -eq $true} |select name, LitigationHoldEnabled
Check all Disabled mailboxes
Get-Mailbox -ResultSize Unlimited | where-object {$_.LitigationHoldEnabled -eq $false} |select name, LitigationHoldEnabled
Activate Litigation hold for "everyone"
Get-Mailbox -ResultSize Unlimited | Set-Mailbox -LitigationHoldEnabled $true
Activate Litigation hold for "every" user mailbox
Get-Mailbox -ResultSize Unlimited -Filter "RecipientTypeDetails -eq 'UserMailbox'" | Set-Mailbox -LitigationHoldEnabled $true
Specify a number of days for the hold
To add a duration, use this syntax : -LitigationHoldDuration 90
"RecipientTypeDetails -eq "UserMailbox'" | Set-Mailbox -LitigationHoldEnabled $true -LitigationHoldDuration 90
Remove Litigation hold for "everyone"
Get-Mailbox -ResultSize Unlimited | Set-Mailbox -LitigationHoldEnabled $false
Remove Litigation hold for "every" user mailbox
"RecipientTypeDetails -eq "UserMailbox'" | Set-Mailbox -LitigationHoldEnabled $false
Check Litigation hold manually
After you script has run, to ensure that all is well you can use this command to ensure its enabled:
Get-Mailbox super.bear@pokebearswithsticks.com | fl Name,LitigationHoldEnabled
That should then confirm the status of True or False - depending on the commands you have used will depend on the result you get here.