Removing disconnected mailboxes in Exchange 2007

In Exchange Management Console you can’t purge disconnected mailboxes. To delete a disconnected mailbox in Exchange 2007 do the following:

1. List all disconnected mailboxes in Exchange Management Shell.
> Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

2. Remove a mailbox
> Remove-Mailbox -Database <database name> -StoreMailboxIdentity <mailbox guid> -confirm:$false

> Remove-Mailbox -Database companyname -StoreMailboxIdentity 6c158c01-0e3f-4a71-8dda-e74921b90b71 -confirm:$false

To remove all disconnected mailboxes i found this on MPCPblog:
1. Remove all disconnected mailboxes
> $users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database

2. Now, all disconnected mailboxes are in a variable and you need to run following cmdlet to remove all of them
> $users | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }






Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.