How to remove (purge) Disconnected Mailboxes

This post is also available in: Polish

If in the Microsoft Exchange Server 2010 we delete mailbox users by selecting the Remove or Disable, mailboxes and their contents are still stored in the Exchange database.

The difference between the operation Remove and Disable:

  • Disable – disconnects the mailbox from email were the user account in Active Directory, leaving the user account enabled, as indicated in the Disconnected mailboxes list, disappears from the address book and it can be reconnected by going in for EMC: Exchange Organization -> Recipient Configuration -> Disconnect Mailboxes
  • Remove – removes the user account in Active Directory with mailbox

If you want to see a list of disconnected mailboxes in specified Exchange databasethen use the command:

Get-MailboxStatistics -Database "MailboxDatabase" | Where { $_.DisconnectDate -ne $null } | select DisplayName, DisconnectDate,TotalItemSize, TotalDeletedItemSize

to show all disconnected mailboxes in specified mailbox server:

Get-MailboxStatistics -Server MBXServer | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate | sort DisconnectDate

After removing the mailbox (Disable), the mailbox does not appear immediately in Disconnected Mailboxes List. It was only after the utility for database Maintence Exchange mailbox will be marked as disconnected and can be found in Disconnected Mailboxes. Same mailbox, however, remain in the database in which there were prior to termination.

Mailboxes in such a state will be stored in the database for 30 days (the default) unless it is changed for a database parameter for how long after removal of mailboxes to be permanently removed.

To speed up the appearance of mailboxes in Disconnected Mailboxes after it is disconnected we can do:

Get-MailboxDatabase | Clean-MailboxDatabase

 

The difference between Disabled mailboxes and Soft-Deleted mailboxes:

Disabled mailboxes - this state is caused by an operation Disable or Remove the active boxes. These mailboxes are stored in a database where they were until the expiry of the retention time for deleted mailboxes. After this time the mailbox will be completely removed and will be released in the database. MailBoxes in this state are not displayed in the address book.

Soft-Deleted mailboxes – arise from moving mailboxes between databases. After the mailbox is moved to a new database in orginal mailbox base is not removed, but switched to soft-deleted state. In such a case will remain in the original database until the expiry of the retention time for deleted mailboxes. To force the removal of such boxes must use the command Remove-Storemailbox.

To see all mailboxes in the database that are Disabled do:

Get-MailboxStatistics –Database “MBXDatabase″ | Where-Object {$_.DisconnectReason –eq “Disabled”}

to remove all disabled mailboxes in database:

$Mailboxes = Get-MailboxStatistics -Database “MBXDatabase″ | where {$_.DisconnectReason -eq “Disabled”}
$Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState Disabled -Confirm:$False}

to remove Soft-Deleted mailboxes in database:

$Mailboxes = Get-MailboxStatistics -Database “MBXDatabase″ | where {$_.DisconnectReason -eq “SoftDeleted”}
$Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted -Confirm:$False}

 

Print Friendly
Tagged , , , , , , . Bookmark the permalink.

One Response to How to remove (purge) Disconnected Mailboxes

  1. Travis says:

    Looks like your blog helpfully added smart quotes on your code snippets.

Leave a Reply to Travis Cancel reply

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

You may 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>