Duplicate Users

Occasional Contributor

Not sure what happened but I have two users with the same UPN.  One is in deleted items and the other is active.  The user is reporting that he can only login via OWA and currently cannot get Outlook to setup correctly.


He is supposed to be a synched user but currently shows in O365 as a cloud user.  The active user has an immutableID  which matches with OnPrem.


So if I run this:

PS C:\WINDOWS\system32> Get-MsolUser -userprincipalname  joe@joecorp.com -ReturnDeletedUsers

UserPrincipalName DisplayName isLicensed
----------------- ----------- ----------
joe@joecorp.com Joe Jones  False


So thinking I need to run:

Remove-MsolUser -UserPrincipalName joe@joecorp.com -RemoveFromRecycleBin


Is there any chance that this command could delete the active user and then permanently delete his mailbox?  I am thinking since it is in the recycle bin and I am specifying -RemoveFromRecycleBin I should be good.


Once I delete this user and the immutabledID matches with Local AD it should sync?  And then hopefully correct the rest of the issues?






1 Reply

Just use the objectID instead of UserPrincipalName when running the cmdlet, that way there is no possibility to delete the wrong one.