Friday, March 31, 2017

Unable to remove Mailbox Database or Uninstall Exchange

I had an issue removing Exchange 2010 today at a customer site. A very generic issue occurred when attempting to perform the uninstall where the following error was generated.

Error:Uninstall cannot continue. Database 'DEVEXCH170-01-CEO and Councillors': This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, or arbitration mailboxes. To get a list of all mailboxes in this database, run the command Get-Mailbox -Database . To get a list of all mailbox plans in this database, run the command Get-MailboxPlan. To get a list of archive mailboxes in this database, run the command Get-Mailbox -Database -Archive. To get a list of all arbitration mailboxes in this database, run the command Get-Mailbox -Database -Arbitration. To disable a non-arbitration mailbox so that you can delete the mailbox database, run the command Disable-Mailbox . To disable an archive mailbox so you can delete the mailbox database, run the command Disable-Mailbox -Archive. Arbitration mailboxes should be moved to another server; to do this, run the command New-MoveRequest . If this is the last server in the organization, run the command Disable-Mailbox -Arbitration -DisableLastArbitrationMailboxAllowed to disable the arbitration mailbox. Mailbox plans should be moved to another server; to do this, run the command Set-MailboxPlan -Database .

This error is normal when you have a database that has a mailbox, archive mailbox or arbitration mailbox. It can also happen if it is associated with a Mailbox Plan (in a multi tenant environment).

In my case, there was no mailbox in the database!

Also the verbose command is meant to show you which mailbox resides in the database in the event one is present as per Exchange MVP Tony Redmond's post here:

In this environment, the mailbox causing the issue was not displayed in the verbose output!

After much troubleshooting I decided to export the entire domain partition to a text file and search for the database name.

This was done with the following command:

dsquery * domainroot -attr * -limit 0

After searching the text file for the database name in question I saw that a legacy user IORepl (which was used by the Inter-Org Replication Tool for a previous cross-forest migration) is associated with the database.

You can do two things here:

Clear the HomeMDB attribute

Delete the object.

As this account is no longer required, I simply deleted the object.

This fixed the problem. No idea why it didn't return the mailbox object in PowerShell!