Forum Discussion
Got error "The specified mailbox "xxxxxxx" isn't unique" when trying to Get-InboxRule
- Jun 04, 2020
You already have all the information you need, no need to request it again. Here's a sample script I wrote a while back for the same scenario: https://www.quadrotech-it.com/blog/office-365-permissions-inventory-mailbox-forwarding/
Using an unique identifier is the correct way to do this, however you might still have some objects in "broken" state, with duplicate attribute values. I'd suggest checking manually the mailboxes returned in those errors.
Also, why the double foreach loop? You can get all the details from the first call of Get-InboxRule.
- ThomasLamJun 03, 2020Copper Contributor
Thanks for the reply. Im using PrimarySmtpAddress which is a unique identifier but just somehow the second for loop cannot get the right value from the Get-Mailbox. And the reason i used double for loop is because the second one need to get the identity value from the first for loop but it also need to get the PrimarySmtpAddress from the Get-Mailbox. So im not sure how it can be archived.
- VasilMichevJun 04, 2020MVP
You already have all the information you need, no need to request it again. Here's a sample script I wrote a while back for the same scenario: https://www.quadrotech-it.com/blog/office-365-permissions-inventory-mailbox-forwarding/
- SystemEngineerDec 12, 2022Iron ContributorHi @Vasil,
Thank you for sharing :-), however, the link has broken.