Skip to content

Instantly share code, notes, and snippets.

@invictus-korstiaan
Last active May 31, 2024 11:35
Show Gist options
  • Save invictus-korstiaan/26753b95cd10f3f171e50acea06fb038 to your computer and use it in GitHub Desktop.
Save invictus-korstiaan/26753b95cd10f3f171e50acea06fb038 to your computer and use it in GitHub Desktop.
# Get all mailboxes
$mailboxes = Get-Mailbox -ResultSize Unlimited
# Iterate through each mailbox and set the default audit set
foreach ($mailbox in $mailboxes) {
Set-Mailbox -Identity $mailbox.Identity -DefaultAuditSet Admin,Delegate,Owner
}
# Disconnect from Exchange Online
Disconnect-ExchangeOnline -Confirm:$false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment