Finding Exchange Database hidden mailboxes.
Story:
Maybe you have been in this situation before, trying to delete an Exchange database after moving all of its mailboxes, arbitration or archives to another server or database but it didn’t work and said that there is still something in the database?
Now I am in a similar situation however I checked nothing in the database as you can see in the below screenshot.

I have noticed that these issues could happen when an Exchange server gets broken or forcefully deleted from AD without properlty uninstalling it. some traces of system mailboxes might remain there with database attributes pointing to the database.
Solution:
Prerequisites:
– You will have to run this script from Exchange Server.
– An account that can connect to Active Directory with at least read permission and Exchange admin read role.
The script will utilize Active Directory and Exchange to get the Database’s distinguished name and scan any AD User Object that has this DB’s DN and post it to you as an output.
Example:
Get-HiddenMailbox -Path ‘C:\example.csv’ -database ‘Affected Database’
As you can see in the below screenshot, I got mostly health mailboxes which should not really be a problme in case you’re deleting database, however I got one system mailbox that is still there and pointing to this Database however, I already have scanned the database for any arbitration mailboxes but Exchange CMDlet showed none.
Now that I know which user it is, the solution for me to be able to remove/delete this database which I no longer need is to delete this AD user object since its no longer in use by Exchange.
You won’t be able to get this mailbox through get-mailbox cmdlet because its not an active mailbox. however you will find it in AD.
So I deleted the mailbox mentioned below and next I am going to try and delete the mailbox database in question.
Result
Here’s the result after deleting the user in Question.