Deleting mailboxes or recovering deleted mailboxes are something that Exchange Admins do often. For a refresher, the disconnected mailboxes will show up 24 hours after they have been removed and you can run a script to identify the disabled ones as below (script from docs.microsoft.com)

  • $dbs = Get-MailboxDatabase
  • $dbs | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisconnectReason -eq “Disabled”} | Format-Table DisplayName,Database,DisconnectDate

When you try and connect a mailbox to an AD user, it is supposed to complete right? What happens when you have two mailboxes on the same database that you want to restore? You get the error below:

Exchange 2016:- mailbox isn't unique on database

The solution to the above is to find the GUID for the mailboxes and restore them that way, here is a command you can use to find the GUIDs:

  • Get-MailboxStatistics -Database DB01 | fl DisplayName,MailboxGuid

You can now proceed with connecting to the database using the command below based on the GUID you got in the previous command:

  • Connect-Mailbox –Identity <guid> –Database DB01 –user RestoreUser1

After this it should connect the account and you can login to the mailbox.

Hope it helps.

    wpChatIcon

    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading