Created
November 2, 2016 11:17
-
-
Save chrisbrownie/16affe1e52966a998d6f985a349c929e to your computer and use it in GitHub Desktop.
Enable Litigation Hold for all Mailboxes in Office 365 https://flamingkeys.com/enable-litigation-hold-for-all-mailboxes-in-office-365/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Connect to Exchange Online | |
$exo = New-PSSession -ConfigurationName Microsoft.Exchange ` | |
-ConnectionUri https://ps.outlook.com/powershell-liveid ` | |
-Authentication Basic ` | |
-AllowRedirection ` | |
-Credential $(Get-credential) | |
Import-PSSession $exo | |
# Get all mailboxes that do not have litigation hold enabled | |
$mailboxes = Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | | |
Where {$_.LitigationHoldEnabled -ne $true} | |
# Enable litigation hold | |
$mailboxes | Set-Mailbox -LitigationHoldEnabled $true | |
Remove-PSSession $exo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment