Monday, 20 April 2015

Permanently deleting disconnected mailboxes that have been deleted / migrated

When deleting / disabling a mailbox - it becomes a "disconnected mailbox" and is retained until the "MailboxDeletion" property of the mailbox database expires e.g. after 8 days.

We should firstly identify the mailbox GUID of the deleted / migrated mailbox:

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq "Disabled" } | ft DisplayName,Database,DisconnectDate,MailboxGuid

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq "SoftDeleted" } | ft DisplayName,Database,DisconnectDate,MailboxGuid

Get-MailboxStatistics -Database MBD01 | where {$_.DisconnectReason -eq "SoftDeleted"} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

Although we can perminently delete these disconnected mailboxes that have been soft-deleted as follows:

Remove-StoreMailbox -Database MBD01 -Identity "2ab32ce3-fae1-4402-9489-c67e3ae173d3" -MailboxState Deleted

OR (mailbox that have been disabled):

Remove-StoreMailbox -Database MBD01 -Identity "2ab32ce3-fae1-4402-9489-c67e3ae173d3" -MailboxState SoftDeleted

0 comments:

Post a comment