Forum Discussion

Skipster311-1's avatar
Skipster311-1
Iron Contributor
Dec 08, 2021
Solved

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 
  • surajbudhani's avatar
    surajbudhani
    Dec 08, 2021
    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

Resources