Last active
May 4, 2021 19:01
-
-
Save glides/71bf3e5bbee3b6b3cad00fd1cf019c5c to your computer and use it in GitHub Desktop.
Enabled logging for all o365 users.
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
| ## There are oneliners that try to enable logging for all users but in a large environment you will run into a data cap for the session - that is why this is split up using a foreach loop | |
| $mailboxes = Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox" -or RecipientTypeDetails -eq "SharedMailbox" -or RecipientTypeDetails -eq "RoomMailbox" -or RecipientTypeDetails -eq "DiscoveryMailbox"} | |
| foreach($m in $mailboxes) { | |
| Set-Mailbox $m.Identity.ToString() -AuditEnabled $true -AuditLogAgeLimit 180 -AuditOwner Create,HardDelete,MailboxLogin,Move,MoveToDeletedItems,SoftDelete,Update,UpdateFolderPermissions -AuditDelegate Create,HardDelete,Move,MoveToDeletedItems,SendAs,SendOnBehalf,SoftDelete,Update,UpdateFolderPermissions -AuditAdmin Copy,Create ,HardDelete ,Move,MoveToDeletedItems,SendAs,SendOnBehalf,SoftDelete,Update,UpdateFolderPermissions | |
| Start-Sleep -Milliseconds 75 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment