Wednesday, 12 November 2008

Orphaned Exchange Store recovery

Guest blog entry by Rick Eveleigh (rick_eveleigh at hotmail dot com)

Got an intact Exchange Store but the Active Directory has gone? Save yourself thousands by following this procedure. No need for EDB recovery tools, Quest, OnTrack PowerControls, etc

Note: this is not a mail migration method: there are better textbook ways of doing that.
Note: this process is not warranted but comments are welcome.


This is Exchange 2003 but may well work on 2000 or 2007. The instructions cover all steps but are not fully detailed as they assume you know the basics of Exchange administration.

Install Exchange 2003 into any domain but with:
1. same server name as the orphaned store
2. same Org name as the orphaned store
3. same Admin Group name as the orphaned store
(You might only find out what the last two should be if installed wrong: the correct ones are in the Application Event Log when the stores fail to mount. In this case you will have to uninstall Exchange and reinstall with the correct Org & Admin Group names)

Make empty Stores in the Exchange System Manager (ESM)
Move to desired location
Mark as 'can be overwritten by a restore'
Dismount

In Windows Explorer, rename the new store names as .bak
Copy the recovered stores into the newly created file location
Rename the recovered stores to match newly created stores
Cross fingers and mount in ESM.

If it doesn’t mount you might have the wrong names as above.

Once mounted:
Expand the store
Right click Mailboxes
Choose Run Cleanup Agent. All will be marked as disconnected.

In Tools, choose Mailbox Recovery Center
Right click Mailbox Recovery Center and click Add Store
Type the first word of the relevant Store (e.g. Staff) and click Check Names
Store should be resolved, click OK
If there are a lot of mailboxes the 'resolve with AD' will take a minute or two
All the mailboxes will be listed
Click Mailbox to sort by Mailbox name (very important!)
Hit CTRL+A to select all Mailboxes
Right click (might be a delay if there are a lot of mailboxes) and choose Export
In the wizard, click Next, Next
Click Browse and find an OU for the users to be made in e.g. 'Recovered Staff Mailbox accounts' (you might need to make this first in AD Users and Computers)
Click Next
Type a name for the exported file (e.g. d:\temp\staff.ldf), choose Replace existing content and click Next
When the export has been completed click Finish

Run a command prompt
Type ldifde -i -f and hit enter

It is very likely there will be an error: all you get is a line number e.g. 'Add error on line 1481: Already exists', if this happens:
Open Active Directory Users and Computers
Browse to the new OU
Open your file (e.g. staff.ldf) in Notepad: for convenience arrange the notepad window alongside the ADUC window
See which account was the last to be created (this is why the list was alpha sorted before export).
Very likely the next account in the ldf file is the problem (might already exist e.g. Administrator, might be a duplicate to the last imported account, might just exist elsewhere in AD, or might be an 'invalid' account e.g. SMTP).
Delete all records from the ldf file up to and including the 'problem' account
Save (don’t close!) the ldf file.
Leave AD Users and Computers and Notepad open and run the ldifde command again.
Repeat until the result of the ldifde command is "The command has completed successfully"

In ESM, Mailbox Recovery Center, ensure all the mailboxes are still selected, right click and choose Find Match.
In the wizard, click Next. The Task will progress and the User Name column in the Mailbox list will populate.
Click Finish when the wizard completes.
Click the User Name heading to bring unmatched mailboxes to the top of the list
Press CTRL+A to select all mailboxes, then holding CTRL, click the mailboxes to deselect them.
Right click on the selected mailboxes and choose Reconnect
In the Reconnect Wizard click Next, Next.
The mailboxes will be reconnected to the newly created AD accounts
When the wizard completes, click Finish

Right click Mailbox Recovery Center and choose Remove Store
Type the first word of the relevant Store (e.g. Staff) and click Check Names
Store should be resolved, click OK.

If you are doing this on a temporary or test server you can now run exmerge to extract the mail. Or your Exchange Stores are now recovered.

Repeat for any other stores.

You can contact Rick via rick_eveleigh at hotmail dot com

No comments: