When you are migrating users to office 365 you can get a lot off issues. One of these issues is when you have duplication errors in your tenant. Duplicate Exchange online Guid Errors can can generate a lot of issues. Think about duplicate accounts or Mailusers are not removable.
When you see these issues you probably do not have a clue on what to do but actually these issues are pretty easy to fix:
Fix Duplicate Exchange Guid Errors:
This fix contains a lot of powershelling to get the error hashes and data you need to perform the action to restore this. To perform these actions with ease i recommend you install the latest versions of Powershell before you continue and make sure you have the permissions needed to continue to Duplicate Exchange Guid Errors
(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. When you purge it you have 2 options The softdeleted mailuser removal or Usermailbox removal.
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
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. Most of the time Purging is needed to continue with the actions.
Next step after purging.
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’
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