Identify and reconnect disabled mailboxes in Exchange Online, 2013 and 2016

For a long time now, Exchange has allowed a grace period, during which mailboxes for deleted or “mail-disabled” AD users are still kept in the database. Sometimes, you might need reconnect such a mailbox to a newly created or pre-existing AD user object.
In order for this to work, Exchange needs to know which mailboxes in the store are available for re-connecting.
The server will synchronize the mailbox state of objects in the database with the state of the corresponding Active Directory user account, to identify mailboxes were the user object has been deleted, or those where the Exchange attributes have been removed.

See also:
Disconnected mailboxes
https://technet.microsoft.com/en-us/library/bb232039(v=exchg.150).aspx

Exchange Online
In Exchange Online you may notice that disconnected mailboxes show-up almost immediately in the Exchange Admin Center (EAC) or when you connect to Exchange Online using remote PowerShell and execute:

Get-Mailbox -SoftDeletedMailbox

In case you are using Exchange Online, check this great article and follow steps how to recover mailboxes:

A better way to recover a mailbox
https://blogs.technet.com/b/exchange/archive/2015/01/13/a-better-way-to-recover-a-mailbox.aspx

Update:  
For various scenarios in Exchange Online and Hybrid deployment you can walkthrough this wizard to identify the required steps.

Restore user mailboxes (mailbox recovery) in Exchange Online
https://support.microsoft.com/en-us/help/20804/mailbox-recovery-in-exchange-online

Exchange On-Premises
For on-premises Exchange 2013/2016 follow the stages 1-3  below:

Stage 1: Synchronize & Identify

After the MSExchangeMailboxAssistant process completes a scheduled run against the database, the mailbox will show up in the EAC, where the mailbox can be reconnected to an existing AD user object.  However, in some scenarios the administrator may have the requirement to reconnect deleted mailboxes immediately and manually start the sync process.
This can be achieved by using the Update-StoreMailboxState CMDLet from the Exchange Mangement Shell (EMS) and is documented on the following TechNet page:

Update-StoreMailboxState
https://technet.microsoft.com/en-us/library/jj860462(v=exchg.150).aspx

In large environments, with multiple AD Sites and Domain Controllers (DCs), you will notice that the documented samples don’t accelerate the Store/AD sync as expected.
To get immediate results in large distributed topologies, you can trigger the MSExchangeMailboxAssistant to immediately show disconnected mailboxes and archives by using the Update-StoreMailboxState CMDLet in the following way:

Get-MailboxStatistics -Database <database> | where{$_.displayname -like "*"} | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }

Replacing the <database> part with your Exchange 2013/2016 database name which contains the mailbox you need to reconnect.

 

Stage 2: Reconnect

Mailboxes that are available for reconnection show up in EAC by selecting the server which has the database mounted containing the desired mailboxes.
Alternatively, you can use the management shell to reconnect these mailboxes by running a command similar to:

Connect-Mailbox -Identity "Mailbox name" -Database <database> -User "User name"

See also:
Connect a disabled mailbox
https://technet.microsoft.com/en-us/library/jj863439(v=exchg.150).aspx

This will force the immediate synchronization between mailbox and AD, allowing the mailbox to be used again.

 

Stage 3: Archive Mailboxes

The Connect-Mailbox CMDlet can’t be used for reconnecting archive mailboxes.
In case the deleted user also had an archive mailbox, you will need to reconnect this manually, using the following steps:

3.1 Find & identify the archive mailbox:

This will help you to identify the Archive Mailbox GUID.

Get-MailboxStatistics -Database <database> | ft displayname,mailboxguid

3.2 Reconnect the archive mailbox

Once identified, you can reconnect the it to an existing Active Directory account.
To reconnect disconnected archive mailboxes, copy the mailboxguid for the archive mailbox and reconnect it running:

Enable-mailbox -identity <Name> -ArchiveGUID <GUID of archived Mailbox> -ArchiveDatabase <DB Name> -Archive

And you're done.

 

 

Ralf Leistner
Support Escalation Engineer