Remove SoftDeleted Mailboxes after a move

Posted on Updated on

Most of the time, when a mailbox is moved from a database to another, the system is unable to delete the mailbox from the source database.  Often, you will find a Move Request status of ‘Completed with warning‘ with details:

Warning: Failed to clean up the source mailbox after the move.
Error details: MapiExceptionUnexpectedMailboxState: Unable to delete mailbox. (hr=0x80004005, ec=2634)

Below are the commands you can use to safely list and delete the mailboxes from the old database location.

List all disconnected mailboxes in a database

Get-MailboxStatistics -Database “Database Name” | Where-Object {$_.DisconnectDate -Notlike $NULL} | Format-Table DisplayName, DisconnectDate, MailboxGuid, DisconnectReason -Wrap

Remove all SoftDeleted disconnected mailboxes from a database

$Mailboxes = Get-MailboxStatistics -Database “database name” | where {$_.DisconnectReason -eq “SoftDeleted”} $Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s