Office 365 – “A user with this name already exists. Use a different name”

Yesterday a friend contacted me when he was trying to recreate a mailbox in his Office 365 subscription and got confronted with the following error message: “A user with this name already exists. Use a different name.”.┬áHe already changed the account name with a “.original” postfix, but the mailbox still keeps the old mail address in the configuration. The issue is described in this support article.

As he wanted to change the mailbox type from shared to regular, he thought about renaming the old one, creating a new one, migrate the data and remove the old mailbox. Needless to say he ran in a hick-up during the creation process of the new mailbox.

PowerShell provides a quick way to discover which mailbox is using the email address. First of all, you need to open a remote PowerShell session to the Exchange environment in your Office 365 subscription. Open a PowerShell window on your pc and execute the following commands:

PS C:\Windows\system32> $cred = get-credential
PS C:\Windows\system32> $session = new-pssession -configurationname Microsoft.Exchange -ConnectionUri https://ps.outlook
.com/powershell -credential $cred -authentication basic -allowredirection
PS C:\Windows\system32> import-pssession $session -AllowClobber

As of this moment, you can execute PowerShell commands directly on your Exchange configuration from your local system. For example:
PS C:\Windows\system32> get-mailbox
Name Alias ServerName ProhibitSendQuota
---- ----- ---------- -----------------
Mailbox1 mbx1 db3pr01mb236 49.5 GB (53,150,220,288 bytes)
Mailbox2 mbx2 amxpr01mb022 49.5 GB (53,150,220,288 bytes)
Mailbox3 mbx3 db3pr01mb0652 49.5 GB (53,150,220,288 bytes)

To quickly discover what mailbox account is already using the requested mail address, you can execute the following command:
PS C:\Windows\system32> get-mailbox| where {$_.EmailAddresses -match "mbx3"} | fl Name, RecipientType, EmailAddresses
Name : info
RecipientType : UserMailbox
EmailAddresses : {SIP:mbx3@domain.be, SMTP:mbx3@domain.be, smtp: mbx3.original@domain.be, smtp:mbx3@domain.onmicrosoft.com}

We already did too much changes to reconfigure the mailbox that it would be more easier to recreate it.
PS C:\Windows\system32> Remove-Mailbox -Identity "mbx3"
PS C:\Windows\system32> New-Mailbox -Name "mbx3" -MicrosoftOnlineServicesID "mbx3@domain.be" -Password (convertto-securestring -string 'P@$$word' -AsPlainText -force)

Make sure once you are done with the reconfiguration to close the PowerShell session by using the following command: Remove-PSSession $session.

Afterwards we imported the PST file again and everything was running as it should! Please note, for redefining the mailbox type you are not obligated to remove the mailbox. The mailbox type can be altered by using the set-mailbox mbx3 -Type ... command. All of the above mentioned commands and troubleshooting can simply be avoided.

Leave a Reply