MCPBlog

How to remove disconnected mailboxes in Exchange Server 2007

Body:
If you are lookin for a way how to purge disconnected mailbox from Exchange 2007 from Exchange
Management Console you in for a big surprise because only way to do it is by using shell. Exchange Server 2007 doesn't allow you to purge the disconnected mailbox and in order to remove single or multiple disconnected mailboxes you can do following:
 
Get all disconnected mailboxes
Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
 
Remove a single disconnected mailbox
Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false
 
Remove all disconnected mailboxes
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database
 
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 }
Category: Exchange
Published: 30.4.2008 9:17

Read the complete post at http://mcpblogint/Lists/Posts/ViewPost.aspx?ID=38