Forum Discussion
Skipster311-1
Dec 08, 2021Iron Contributor
Automatically put mailbox on lithold
Hello
When a knew mailbox is created i want it to be automatically put on litigation hold. What is the best way to do this? We are currently in hybrid Exchange environment
- As Vasil recommended, if users are in Exchange Online you can use Retention Policies in security and compliance center to ensure mailbox data is not deleted.
If you want to use PowerShell to find users with a specific license and then enable litigation hold you can try the following command:
$Users = Get-MsolUser | Where-Object {($_.licenses).AccountSkuId -match "Contoso:EnterprisePack"}
$Users | %{Set-Mailbox $Users.UserPrincipalName -LitigationHoldEnabled $true}
Note: match phrase "Contoso:EnterprisePack" is the account SKU (License) that you are looking for, you can find the SKU using the following command: Get-MsolAccountSku and replace it accordingly
5 Replies
Sort By
- Where is the mailbox located? On-premises, you can easily automate this with the Exchange scripting agent or just schedule a PS script. In O365, best take advantage of the "org-wide" retention policies or the recently-introduced "adaptive scopes": https://docs.microsoft.com/en-us/microsoft-365/compliance/retention?view=o365-worldwide#auditing-retention-configuration-and-actions
- Skipster311-1Iron ContributorThanks Vasil. Can you point me to a script that looks at a particular O365 license, and if found put the mailbox on lithold
- surajbudhani
Microsoft
As Vasil recommended, if users are in Exchange Online you can use Retention Policies in security and compliance center to ensure mailbox data is not deleted.
If you want to use PowerShell to find users with a specific license and then enable litigation hold you can try the following command:
$Users = Get-MsolUser | Where-Object {($_.licenses).AccountSkuId -match "Contoso:EnterprisePack"}
$Users | %{Set-Mailbox $Users.UserPrincipalName -LitigationHoldEnabled $true}
Note: match phrase "Contoso:EnterprisePack" is the account SKU (License) that you are looking for, you can find the SKU using the following command: Get-MsolAccountSku and replace it accordingly
- Skipster311-1Iron Contributorall mailboxes are in EXonline. Thank you