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
- Dec 08, 2021As 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-1
Dec 08, 2021Iron Contributor
Thanks 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
Dec 08, 2021As 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
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