Exchange: Deleting Auditlog Mailbox

Deleting default mailbox database,

This weekend I got a call from one of my friends.  They were pulling their hair out, trying to remove a default database from a lab Exchange installation, and they kept receiving the error “The mailbox database contains one or more mailboxes, mailbox plains, archive mailboxes, public folder mailboxes, or arbitration mailboxes…”. But, looking in the admin GUI, no end user mailboxes were present.  What to do?

It turns out that Exchange 2016 has a new system generated mailbox type called an “AuditLog” which contains log events, if you enable any of end user mailboxes.  Even if you haven’t used this feature, Exchange will refuse to delete any mailbox database that contains this system mailbox.  To find whether this is your problem, run the following in the Exchange Management Shell on the server you are trying to remove the mailbox from:

Get-MailboxDatabaseCopyStatus

Then, look for the exact name of the database you are trying to remove.  You can right-click the EMS header and select Edit | Mark,,,, highlight the database name…. Hit the enter key to get the name into the clipboard.  Then, run the following command:

Get-Mailbox -Database <Database-Name> -AuditLog

Note that if you don’t use a parameter, this command returns end user mailboxes.  You can also request -Arbitration -PublicFolder -Archive mailboxes with this command.  To fix the problem, you can move the offending mailbox into another database.  If this is the last database in your Exchange environment, then you would need to delete the mailbox.  My friend had already created other databases, with pretty names, so moving the mailbox was appropriate:

Get-Mailbox -Database <Database-Name> -AuditLog | New-MoveRequest -Targetdatabase <Database Name>

As you can see, you can just pipe the results into the New-MoveRequest command, wait several minutes for the request to be processed, and then proceed with deleting the database.  Hope this prevents you from experiencing the same frustration of knowing there are no mailboxes, and yet receiving this cryptic Microsoft error message.