Removing disconnected mailboxes in Exchange Server 2007

Hello folks,

Exchange Server 2007 doesn’t allow us to purge the disconnected mailbox. In order to remove one or multiple disconnected mailboxes we can be performing these steps:

Listing all disconnected mailboxes

Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

Removing a single entry

Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false

Removing all users at the same time

$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

Now that we have all disconnected mailboxes in a var, we can run the following cmdlet to remove all of them:

$users | ForEach { Remove-Mailbox -Database “Mailbox Database” -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

Best Regards,
Anderson Patrico

Technorati : , , , : , , ,
Ice Rocket : , , ,

4 thoughts on “Removing disconnected mailboxes in Exchange Server 2007

  1. Thanks…

    just a little improvment to remove on all databases of the server:

    $users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database

    $users | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

Leave a Reply to Daniel Cancel reply

Your email address will not be published. Required fields are marked *