Exchange 2010 – Cannot login after mailbox has been disabled and attached to different AD user account

I was asked to rename an Exchange account (sitting on an Exchange 2010 SP2 server) for a customer today because the surname had changed so to do this tidily, I disabled the Exchange Mailbox, cleaned up the Databases to make the mailbox appear in the Detached Mailboxes folder using the following Exchange Management Shell command:

get-mailboxdatabase | clean-mailboxdatabase

clean_mailbox

 

 

 

 

 

 

 

 

 

 

 

 

Once that had run, I then deleted the AD user account, created a new AD user account and then Connected the Detached Mailbox to the new AD user account.

All done – I then informed the user of the new login credentials and they then setup their Outlook account accordingly.

It was then that the problem occurred.  They couldn’t login to their account.  They tried OWA and that failed too, saying that the account was disabled!  What the heck?

I tried using OWA and also got Account Disabled and saw the following error message when expanding the error:

Exception type: Microsoft.Exchange.Data.Storage.AccountDisabledException

I checked the AD account and it wasn’t disabled.  Forced an AD Replication and that made no difference.  I disabled the account – replicated AD – enabled the account – replicated AD again and still couldn’t login to OWA.

After a few checks and some head scratching, I re-ran

get-mailboxdatabase | clean-mailboxdatabase

and then was able to login to OWA as the user and they could login to Outlook.