How to Restore Active Directory Account and Mailbox using Exchange Database
In this article, I have explained the various steps involved in re-producing the subject issue.
Before you begin To perform the following procedures, the account must be delegated the following:
• Exchange Organization Administrator Role
Though this article was already present in TechNet site, I have tried to make it easier to understand with some screenshots.
Now in the previous versions of exchange it was quite easy to restore the backup to recovery server (EXCHANGE 2000) or by creating RSG (EXCHANGE SERVER 2003). In Exchange server 2007 the process is different. I am going to show you how this can be accomplished by using Exchange Management Shell.
For testing purpose I had created few accounts. And will be deleting those accounts after taking backup.
Now an administrator has three options in Exchange Server 2007 for deleting an AD account.
Either we can use EMC, EMS or Active Directory Users & Computers.
Below is an example using EMS? Here we are deleting RAM.
Below is an example using EMC? Here we are deleting SAM account; however the mailbox will show in the disconnected mailbox. The user will lose all AD related permission.
Be careful while selecting the Remove option.
Below is an example using ADUC? Here we are deleting TAM. The mailbox will show in the Disconnected Mailbox.
Now since I have a backup I can either restore data directly to the production, doing so will lead to downtime & there will be an inconsistencies for end users (Not recommended).
The best option is to create Recovery Storage Group.
In this example I had already created RSG. If you have trouble creating RSG please refer to TechNet site.
Since Exchange Server 2007 has the capability of mounting database on any server within the same ORG.
In this example I had created RSG & moved the database to a newly created Mailbox Store. New Database was created since we don’t have an option of getting Mailbox Statistics using Exchange Management Shell for RSG. Once the database is restored to RSG check the database health and then copy it to the Production Store (Temporary).
Make sure you rename the database file.
For example in our case the database file name was Mailbox Database.edb. I had renamed it to Mailbox Databases.edb.
I will be sending the CreateLdifFromDisconnectedMailboxes.ps1. Remember you have to paste this .ps1 file in the below location.
C:\Program Files\Microsoft\Exchange Server\Scripts
Run the below command to create .ldf file.
Here I had created an OU named “DisasterRecovery”. Customer might have OU’s so simply provide the DN of the OU and the command will export all disconnected mailboxes and associated user account to file named as “ldifout.ldf”.
Note: – The user accounts are still not created.
In the above notepad I had removed all other accounts and I just kept only those accounts for which we are working. (RAM, SAM & TAM).
In the above command it says only 3 entries modified. This is because I had modified the .ldf file. Once the above command completes successfully you can see the account and mailbox created.
Since we had created this users and mailboxes using Exchange Management Shell. You have to restart IIS & MsExchangeIS service. Further you have to make sure UPN for these users is showing up in the Active Directory Users & Computers if not add them manually.
Now you can see SAM is able to login and able to see his old emails.
Make a note of this Technet article to help with downloading scripts: http://technet.microsoft.com/en-us/library/bb430758(EXCHG.80).aspx
Applies to Exchange Server 2007 SP1