Exchange has the useful ability to re-connect mailboxes that have become disconnected. This allows administrators to recover mail data after mistakes have occurred such as Mailboxes being disabled, or Active Directory user accounts being deleted.

However, before a mailbox can be re-connected, the database must realise that the mailbox has actually been disconnected.  In most situations, Exchange will detect this quickly, but at times this can take a while to occur.

In Exchange 2010, a command existed to speed up this detection process. The cmdlet was called Clean-MailboxDatabase, however, this command no longer exists in Exchange 2013.  For Exchange 2013, the functionality has been replaced with Update-StoreMailboxState.

The main difference between these two commands is whereas Clean-MailboxDatabase scanned an entire mailbox to find ‘orphaned’ mailboxes, Update-StoreMailboxState works on individual mailboxes. Unfortunately, to use Update-StoreMailboxState you need to specify both the database the mailbox was in, and the identity of the mailbox to be acted upon.  The mailbox is referenced with its MailboxGUID so you will probably need to run Get-MailboxStatistics to find out what this is.

http://technet.microsoft.com/en-us/library/jj860462%28v=exchg.150%29.aspx has more details on this command, including examples of how to run the command, for example to make the command run in the same way as Clean-StoreMailbox you could run:

  1. Get-MailboxStatistics -Database DB03 | Where { $_.DisconnectReason -ne $null } | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }