Exchange 2010 – Delete / Remove all Disconnected Mailboxes

KB ID 0000470 

Problem

In older versions of Exchange, we just had to “Purge” disconnected mailboxes, now we don’t have that option.

Solution

WARNING this will remove ALL disconnected mailboxes, make sure you actually want to do this before proceeding.

Launch > Exchange Management Shell.

Issue the following commands;

[box] $mailboxes = Get-ExchangeServer | Where-Object {$_.IsMailboxServer –eq $true} | ForEach-Object { Get-MailboxStatistics –Server $_.Name | Where-Object {$_.DisconnectDate –notlike ‘’}} | select displayname, mailboxguid, database [/box]

Then;

[box] $mailboxes | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false } [/box]

2. If you have the Exchange Management console open (as above), you may need to refresh, before they disappear.

Related Articles, References, Credits, or External Links

NA