Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arjancornelissen/34c772440e1d232d76d0b7f54e07bee5 to your computer and use it in GitHub Desktop.
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
$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