When I run this command I'm getting an error on enabling a few accounts for auditing.
Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox" -or RecipientTypeDetails -eq "SharedMailbox" -or RecipientTypeDetails -eq "RoomMailbox" -or RecipientTypeDetails -eq "DiscoveryMailbox"} |
Set-Mailbox -AuditEnabled $true -AuditLogAgeLimit 180 -AuditAdmin Update, MoveToDeletedItems, SoftDelete, HardDelete, SendAs, SendOnBehalf, Create, UpdateFolderPermission -AuditDelegate Update, SoftDelete, HardDelete, SendAs, Create, Update FolderPermissions, MoveToDeletedItems, SendOnBehalf -AuditOwner UpdateFolderPermission, MailboxLogin, Create, SoftDelete , HardDelete, Update, MoveToDeletedItems
Then I get this error here,
The operation couldn't be performed because 'Employee Name' matches multiple entries. + CategoryInfo : NotSpecified: (:) [Set-Mailbox], ManagementObjectAmbiguousException + FullyQualifiedErrorId : [Server=removed,RequestId=removed,TimeStamp=8/16/2018 8:54:51 PM] [FailureCategory=Cmdlet-ManagementObjectAmbiguousException] B88862F7,Microsoft.Exchange.Management.RecipientTasks.SetMailbox + PSComputerName : outlook.office365.com
Then I'm running this command to see who is enabled and who isn't
Get-Mailbox -ResultSize Unlimited |
Select Name, AuditEnabled, AuditLogAgeLimit |
Out-Gridview
Which pops up a GUI and show's me a few Employee's that are duplicate. This is because we have two different domain names with different email boxes. Example: [email protected] and [email protected]. How do I enable those duplicate accounts in PowerShell?