Created
April 3, 2019 09:38
-
-
Save arjancornelissen/34c772440e1d232d76d0b7f54e07bee5 to your computer and use it in GitHub Desktop.
Script to set every mailbox to use the default auditing settings from Microsoft
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
$mailboxes = Get-Mailbox -ResultSize Unlimited | |
$total = $mailboxes.Count | |
$count = 0 | |
foreach($mailbox in $mailboxes){ | |
Write-Progress -Activity "Updating auditing: $($mailbox.UserPrincipalName) ($count or $total)" -PercentComplete ($count/$total*100) | |
$count++ | |
Set-Mailbox -Identity $mailbox.ExternalDirectoryObjectId -DefaultAuditSet Owner, Admin, Delegate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment