Can we automate litigation hold on specific mailboxes and while onboarding new employees to a certain department

Mohan Chinnaswamy 1 Reputation point
2022-03-29T14:49:53.787+00:00

we want to place members (existing and new) from specific department always on litigation hold permanently - is there way to achieve it?

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Exchange | Exchange Server | Development
Exchange | Exchange Server | Management
{count} votes

3 answers

Sort by: Most helpful
  1. Simon Burbery 691 Reputation points
    2022-10-14T03:04:48.747+00:00
    1 person found this answer helpful.
    0 comments No comments

  2. Andy David - MVP 157.8K Reputation points MVP Volunteer Moderator
    2022-03-29T15:07:51.837+00:00
    0 comments No comments

  3. KyleXu-MSFT 26,396 Reputation points
    2022-03-30T02:19:56.907+00:00

    @Mohan Chinnaswamy

    For Exchange online, there doesn't exist such function. Here may be a work around for you:

    You could follow this blog to create a Task Scheduler to run script below daily, it will check and enable LitigationHold for mailbox.

    #Conenct to Exchange online, remember to change the Accout and Password  
    $Account = "******@domain.onmicrosoft.com"  
    $PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force  
    $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $Account, $PassWord  
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection  
    Import-PSSession $Session -DisableNameChecking  
      
    #Find mailbox which belong to Department 321, if LitigationHold isnot enabled, enable this function for that mailbox  
    $users =  Get-User -Filter "Department -eq '321' -and RecipientType -eq 'UserMailbox'"  
    ForEach($user in $users){  
        if (!(Get-Mailbox $user.name).LitigationHoldEnabled) {  
            Set-Mailbox $user.name -LitigationHoldEnabled $true -LitigationHoldDuration unlimited  
        }  
    }  
      
    #exit  
    Remove-PSSession $Session  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.