Exchange 2010 Purge Disconnected Mailboxes

Applies to: Exchange 2010

There is sometimes the need to permanently delete disconnected mailboxes. For example, if you moved mailboxes between databases, the previous database will still hold a copy of the moved mailboxes (by default for 30 days). If you’re tight on disk space, you might want to delete the disconnected mailboxes manually.

Note: Your Exchange database file size will not decrease right-aways, however, the Exchange Mailbox Server(s) will immediately have free space inside the .edb file for new emails.

Step 1: Retrieve List of Disconnected Mailboxes

Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq “SoftDeleted”} | Select DisplayName,ServerName,Database,ItemCount

Step 2a: Permanently Delete an Individual Disconnected Mailbox

Remove-StoreMailbox -Database (Database) -Identity (useralias) -MailboxState SoftDeleted

Step 2b: Permanently Delete all Disconnected Mailboxes across all Databases (enter below commands into a .ps1 file before executing)

$var1 = Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq “SoftDeleted”}

$var1 | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>