How to Fix Duplicate Exchange online Guid Errors in Office 365
These errors can generate a lot of issues, think about duplicate accounts or Mailusers that are not removable.
Actually these issues are pretty easy to fix:
(Get-MsolUser -UserPrincipalName email@example.com).errors.errordetail.objecterrors.errorrecord| fl
#Search in EXO PowerShell for the object that is using the mentioned EXchangeGUID or ArchiveGUID:
Get-Recipient -IncludeSoftDeletedRecipients 'ExchangeGUID value'|ft RecipientType,PrimarySmtpAddress,*WhenSoftDeleted*
#Once you found the object that is using this ExchangeGUID or ArchiveGUID, you have to purge it:
#1. If it is a softdeleted MailUser:
Remove-MailUser ‘ExchangeGUID value' -PermanentlyDelete
#2. If it is a softdeleted UserMailbox, run:
Remove-Mailbox 'ExchangeGUID value' -PermanentlyDelete
#-if this command fails due to mailbox being protected by hold, you have to disable the hold first(check if data backup is required):
Set-Mailbox firstname.lastname@example.org -LitigationHoldEnabled $false -InactiveMailbox
#3. If it turns to be an active mailuser/mailbox that is using this ExchangeGUID/ArchiveGUID, you need to evaluate the option to purge that user.
#4. After the faulty object has been purged from EXO, we need to fix the validation error by forcing the object provisioning:
Get-MsolUser -UserPrincipalName email@example.com |fl *objectID*
Redo-MsolProvisionUser -ObjectId 'paste the *objectID* value from above command'
#5. Wait for 5 minutes and then run the next command, to confirm if your validation error is fixed:
(Get-MsolUser -UserPrincipalName firstname.lastname@example.org).errors.errordetail.objecterrors.errorrecord| fl