Remove Disconnected Mailbox – Exchange 2007

A simple bit of Powershell to remove a Disconnected Mailbox. Normally Exchange will take care of this itself at the predetermined time as set under Database properties, under the limit tab, via the GUI or via Exchange Powershell

[PS]C:\> Get-MailboxDatabase "ExchangeClusterName\DatabaseName" | fl DeletedItemRetention

Note: You must run this on a mailbox server.

This just tells Exchange to hold onto deleted mailboxes for x number of days at which point permanently delete the mailbox. So that said what if you have a really large mailbox that you want to delete, or a mailbox you want to remove more quickly, for some other reason. In that case you can’t use the Exchange gui to select and delete them, instead you’ll need to ID the disconnected mailbox by its Name and then reference its GUID to delete it. The commands to do so are listed below. Nothing fancy here just two lines of code.

You need to make sure the Exchange\DatabaseName is the one where the mailbox actually was stored otherwise nothing will happen.

[PS] C:\> $Temp = Get-MailboxStatistics | Where {$_.DisplayName -eq "John Doe"}
[PS] C:\> Remove-Mailbox -Database "ExchangeClusterName\DatabaseName" -StoreMailboxIdentity