Sunday, April 30, 2017
  • Home
  •             

Enable Legal Hold by using PowerShell

June 23rd, 2014 by Jabez Gan [MVP]

Statement:

You have purchased some Office 365 E3 plans and have assigned the Office 365 E3 licenses to the users.

You would like to activate Legal Hold for these users in bulk, using PowerShell.

Script to Activate:

  1. # First you need to be connected to the Exchange PowerShell.
  2. $pagesize = 100# The number of mailboxes per loop
  3. $inc = 0# Start increment value
  4. # Continue until all mailboxes are litigation hold enabled
  5. do {
  6.     Write-Output “Getting mailboxes”
  7.     # Get UserMailboxes that does not have litigation hold enabled
  8.     $mailboxes = GetMailbox Filter {LitigationHoldEnabled -eq $false -andRecipientTypeDetails -eq “UserMailbox”} ResultSize $pagesize WarningAction SilentlyContinue
  9.     if($mailboxes) { Write-Output (“Current mailbox count: {0}” -f ($inc += $mailboxes.Count))}
  10.     # Enable litigation hold
  11.     $mailboxes | SetMailbox LitigationHoldEnabled $true WarningAction SilentlyContinue
  12. } while($mailboxes);

Source: Goodworkaround.com

Posted in Office365 | Comments Off on Enable Legal Hold by using PowerShell


This entry was posted on Monday, June 23rd, 2014 at 8:13 am and is filed under Office365. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.


Comments are closed.