You can check what mailboxes are disconnected using EMC by going to Recipient Configuration –> Disconnected Mailbox
But you cannot delete a disconnected mailbox using EMC (But database maintenance task will remove them after the set period of time, by default after 30 days)
You can see which mailboxes are either removed or disabled on the server by running the following command in Exchange Management Shell:
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -ne $null} | ft displayname,database,disconnectreason -auto
If you wanna force the deletion of a mailbox, please use the following command:
Remove-StoreMailbox -Database <Database Name> -Identity <Display Name> -MailboxState SoftDeleted
if the mailbox is Disabled:
Remove-StoreMailbox -Database <Database Name> -Identity <Display Name> -MailboxState Disabled
You will have to use the display name for Identity parameter as nothing else will work.
If you want to do this to all disabled/removed mailboxes for a given database, try this:
Get-MailboxStatistics -Database <database name> | where {$_.DisconnectReason -eq “Disabled”} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.displayname -MailboxState Disabled}
You can change DisconnectReason and MailboxState to “SoftDeleted” if the mailbox was removed instead of disabled.