When an Exchange user-account that was 'mailbox-enabled' is deleted or disabled, it is disjoined from the user object of active directory account. All attributes of the mailboxes are removed but the mailbox does not get permanently deleted on the spot. These mailboxes that are disabled or deleted are called Disconnected Mailboxes that get purged from the database automatically after retention period or manually by using remove-StoreMailbox cmdlet. Also, if needed, disconnected mailboxes can be again connected with mailbox database.
Follow the Path:
Console Tree: Exchange Management Console » Organization Configuration » Mailbox
Work Area: Database Management » Select Mailbox » Right-Click and choose Properties » Mailbox Database Properties.
Notice that retention period for the disconnected mailbox is set 30 days which means when it is deleted, it will be retained by Exchange for this number of days. However, this limit can be extended using the Set-MailboxDatabase cmdlet: Set-MailboxDatabase < DatabaseID > -MailboxRetention DD.MM:HH:SS
To open Queue Viewer:
For example: 60 days retention period for a disconnected mailbox can be set with following cmdlet: Set-MailboxDatabase MDB1 –MailboxRetention 60.00:00:00
To remove a disabled or soft deleted mailbox and its content, PowerShell cmdlet "Remove-StoreMailbox" can be used. This way, a mailbox data is permanently deleted which means the mailbox is purged. However, note that you cannot directly run this command against an active mailbox on Server as it would result in error (stating process failure). It is strictly recommended to process this command against a disconnected mailbox only.
Exchange 2010 Remove-StoreMailbox Cmdlet: Remove-StoreMailbox –Database < DatabaseID > –Identity < MailboxID > –MailboxState [Disabled|SoftDeleted]
Say you want to remove source mailbox named "Alena" after moving it to another database, the command that will be used is: (Here, you can notice that state of disconnected mailbox (Soft deleted or disabled) has to be defined) – Remove-StoreMailbox –database DB1 –identity Alena –MailboxState SoftDeleted
If all soft deleted mailboxes from a database have to be purged, following cmd can be used: (Here exemplified through database named DB1) – Get-MailboxStatistics –Database DB1 | where {$_.DisconnectReason –eq "SoftDeleted"} | foreach {Remove-StoreMailbox –Database $_.database –Identity $_.mailboxguid –MailboxState SoftDeleted}
Using these PowerShell Commands will help you to purge disconnected mailboxes Exchange 2010!