Exchange 2007,  Exchange Management Shell,  Microsoft Exchange

Deleting disconnected Mailboxes in Exchange 2007

Purging disconnected mailboxes in Exchange 2003 was quick and easy.

With Exchange 2007 you need to use the Exchange Management Shell to purge/delete the disconnected mailboxes. Below are some examples on how to delete disconnected mailboxes in Exchange 2007. Make sure that you need to delete the disconnected mailboxes as it’s easier to reconnect a disconnected mailbox if a user account and mailbox got deleted by accident.

Delete a specific disconnected mailbox:

1. Get-MailboxDatabase (this will show you  the database names)
2. Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid (view the user’s GUID here)
3.  Remove-Mailbox -Database Type Your Database Name Here -StoreMailboxIdentity Type the Users Mailbox GUID Here -confirm:$false

Delete all disconnected mailboxes from a specific database:

First create a variable $users as per point 1

1. $users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
2. $users | ForEach { Remove-Mailbox -Database “Type Your Database Name Here” -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

All the disconnected mailboxes in the specific database will now be deleted.

Leave a Reply

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