Purge all disconnected mailboxes in Exchange 2007

29 January 2010

If you want to purge all your mailboxes in Exchange 2007, simply follow the below:

1) Open ‘Exchange Management Shell’

2) Add all the disconnected mailboxes into a var by typing the below:

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

3) Purge all the disconnected mailboxes in the previously made var by typing the below:

$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.