Recovering an Exchange 2007/ 2010/2013/2016/ Server using the RecoverServer switch

Summary: The guide explains how to use Setup /m:RecoverServer switch to recover Exchange Server 2007, 2010, 2013, 2016. Also, it outlines steps to mount and restore the mailbox database from failed or dead Exchange server to a new server without data loss. But if Setup m RecoverServer fails to restore the mailboxes, use an Exchange Recovery software, such as Stellar Repair for Exchange.

Exchange server monitoring is critical to ensure smooth running of the server at all times. But no matter how well you monitor the Exchange server, at some point in time, you may experience a situation when Exchange server completely breakdown and fails to boot. This may happen due to damaged hardware or corrupt software. There are many reasons why server is fail to start:

There are two cases-

  1. A standalone Exchange Server is a server
  2. Exchange server that is a member of a DAG

A standalone Exchange server-

If it?s caused by a hardware failure, you may replace it and bring the server back online. However, if the damage is caused by corrupt software or operating system, you can use the setup /m:RecoverServer switch to recover Exchange Server 2007/2010/2013/2016 & restore mailbox database. But if the Setup m RecoverServer fails to restore the mailboxes and database on new server, you can use an Exchange Recovery software, such as Stellar Repair for Exchange. The software helps you repair and extract the mailboxes from the corrupt or damaged Exchange server database and import the mailboxes to new Exchange server 2007/2010/2013/2016 directly. It also provides options to map mailboxes and creates mailboxes for mapped users accounts.

What is Setup /m:RecoveryServer Switch?

When the Exchange server fails and doesn?t start, an administrator can use Setup /m:RecoverServer switch command to rebuild a new Exchange server with the same name by using the settings and information stored in Active Directory.

Prerequisites before you begin Exchange Server Recovery?

First of all, before we begin re-installing the server, we need to ensure we have all the media in hand. We would need to same operating system along with the same version build of Exchange Server which was installed before. Adding to this, although the server might not be booting or having issues, the best thing is to either take a backup of the databases in a safe place or move the server in a sandbox environment. This will ensure the recovery of files if needed. One must also have in hand the full updated documentation of the Exchange Server, this will ensure the installation to be done as the original so that minimal interruptions will be suffered.

Since most of the configuration of the Exchange Server is in the Active Directory and we are rebuilding Exchange server, it is important that apart from the same software versions, one must build the server with the same storage and drive letters. When rebuilding a new server, the certificates will not be retained and a self-signed certificate will be created, so it?s important that after the installation the certificate is re-installed on the server and assigned to the services.

How to recover Exchange server 2007, 2010, 2013, 2016 using /m:RecoveryServer Switch?

To use Setup /m:RecoverServer for recovering Exchange server, you need to create a new server with the same hardware and software configuration as the existing one. In short, the new server should be an exact replica of the old Exchange server.

  1. Get a server chassis and build a new Windows server instance with the same service pack and naming convention 
  2. Install identical characteristics as the failed server
  3. Make sure to install the same hardware components as available in failed Exchange server
  4. The drive letters and partitions should be the same
  5. Install Operating system and Antivirus
  6. Install Exchange server roles
  7. Perform recovery install of Exchange server by running the setup with the /m:RecoverServer switch
  8. Verify that all custom configurations are applied, if not then re-apply
  9. Join the Exchange server to the same domain. First, reset computer account that already exists in the AD
  10. Install the Exchange server pre-requisites
  11. Finally, create a copy of Exchange server setup files at the location where these are accessible. Use the same setup file for Exchange that was previously installed on the server
  12. Open the command prompt as an administrator and use the cd command to change the directory containing Exchange setup files
  13. Then enter the following command in command prompt window
setup /m:RecoverServer /IAcceptExchangeServerLicenseTerms

Restore Custom Configurations

As mentioned earlier, Exchange stores most of the Exchange configuration settings and other information such as directory settings, transport settings, location and database names, etc. in Active Directory (AD). These settings and information are restored when you execute the Setup /m:RecoverServer command.

However, to restore the server-specific configurations, such as SSL certificate, you can export the certificate and then import it to the new recovered server. Once imported, you can then enable the SSL for all other Exchange services.

Similarly, you must document and restore other server-specific custom configurations such as IIS settings, modified Config files or Registry keys and more to the recovered server.

If previously one would have had Scripting agents installed, you might encounter the following error while reinstalling the server in recovery mode.

"Initialization failed: '"Scripting Agent initialization failed: "File is not found: 'C:\Program Files\Microsoft\Exchange Server\V15\Bin\CmdletExtensionAgents\ScriptingAgentConfig.xml'.""' ---> Microsoft.Exchange.Provisioning.ProvisioningException: "Scripting Agent initialization failed: "File is not found: 'C:\Program Files\Microsoft\Exchange Server\V15\Bin\CmdletExtensionAgents\ScriptingAgentConfig.xml'."" ---> System.IO.FileNotFoundException: "File is not found: 'C:\Program Files\Microsoft\Exchange Server\V15\Bin\CmdletExtensionAgents\ScriptingAgentConfig.xml'."

To resolve this one could use the PowerShell command below to resolve the matter.

Disable-CmdletExtensionAgent -Identity “Scripting Agent”

After the installation is done as illustrated above, one can go ahead and re-enable the scripting agent using the following command.

Disable-CmdletExtensionAgent -Identity "Scripting Agent"

How do you know this worked?

After every operation or task, one must ensure that the Exchange server recovery procedure was successful, and that all data was recovered along with all services working in top shape. After the installation of the server in recovery mode and before doing anything else, it?s important to verify that all the services are running from the services.msc.

All the outside accessible services need to be tested and verified, especially when it comes to the server certificate.

Enable Exchange Services and Restore Exchange Mailbox Database

Now that you have successfully recovered and restored failed or dead Exchange server, check if everything is working fine. If the volumes containing mailbox databases and transaction logs are configured with same drive letters or mount points, the database mounts successfully and continues operation with no data loss. In case the database is lost due to server failure, use the backup to restore the lost Exchange database. Note: If you are facing access denied error while Setup /m RecoverServer switch, make sure you have assigned all necessary permissions which would be to have Local and Active Directory administrator rights on the server.

Ideally, the Exchange database backups are stored at a different location. This helps when there is an issue of dirty shutdown error or database corruption.

Check that Exchange database backup is authentic and start the restore procedure. But before that, you must ensure that the backup isn?t obsolete or corrupt.

Soft Recovery with Eseutil

If the database and log files are available (or restored from backup) but the server fails to mount Exchange database, use Exchange?s inbuilt-utility Eseutil for soft recovery. This helps restore the database and log files. The steps are as follows:

Eseutil /ml ?Path of the log files\log prefix?

 For instance, Eseutil /ml H001.log

Eseutil /r <Log Prefix> /l ?Path of the folder containing log files? /d ?Path of the folder containing database?

For instance, ESEUTIL /r H001 /l ?C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Mailbox Database 16434? /d ?C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Mailbox Database 16434?

However, due to EDB-STM mismatch, you may encounter the following error,

  1. Operation terminated with error -1216 (JET_errAttachedDatabaseMismatch, An outstanding database attachment has been detected at the start or end of recovery, but the database is missing or does not match attachment info) after n seconds.? 
  2. Unable to mount database after a setup /m:RecoverServer in Exchange 2016

To resolve this error, run soft recovery with the ?/i? switch at the end of command.

Hopefully,  this will resolve the problem and restore the Exchange database. If not, it would be best if you employ an Exchange Recovery tool to repair corrupt database and then mount the database.

Rating by MVP:

Video Tutorial:

Stellar Repair for Exchange – to recover Exchange server 2007, 2010, 2013,  2016

Stellar Repair for Exchange is one of the most reliable Exchange data recovery tools to recover Exchange data when inbuilt utility and backup fails to restore the database due to corruption. This software repairs corrupt databases, which might have prevented mounting of database and log files during soft recovery.

Though it?s always at the discretion of Exchange Administrators to select disaster recovery methods and combat crisis, it is recommended to include an Exchange recovery software as part of their disaster recovery plan. This is because Exchange Administrators cannot be available 24x7x365 and Exchange breakdown happens unannounced. Having a GUI-based Exchange Recovery software can greatly help in such situations.

What if you have an Exchange Server which is a DAG member and failed, you can follow Recover Exchange DAG member server.

Synopsis

Though there is always a disaster recovery plan ready and available for all organizational processes, it doesn?t ensure a cent percent recovery when a crisis hits. In case of an Exchange server breakdown, recovering Exchange Server with the help of setup /m RecoverServer is an ideal disaster recovery technique. This switch works for Exchange server 2007/2010/2013/2016. However, it hardly proves to be successful mainly due to Exchange mailbox database corruption, which may happen when Exchange server crashes or shutdowns unexpectedly.

In such cases, you must implement an Exchange recovery software like Stellar Repair for Exchange to overcome database corruption, resolve common problems with Exchange mailbox database, and ensure mailbox database recovery. To know more about the software, please read the MVP & Subject Matter Experts Review. 

Q. Can I restore Exchange server from backup?

A. Yes, that would be possible to restore the entire machine from backup, but this would mean that the current server is replaced with a working server with a day-old data. All the data will be lost from when the backup happened till when the issue occurred. It?s always best to try first to recover the current server before ending in restoring the entire thing.

Q. Does these steps also work for Exchange server 2019?

A. For Exchange Server 2019 is a little bit different from Exchange Server 2010 and 2007. It?s like Exchange Server 2013 and 2016 since all the configuration is stored in the Active Directory. So, the steps would be to re-create the server with the same specifications, structure and naming conventions, same IP, same operating system, and same version of Exchange Server. The next step is to recover the data from the EDB file using specialized tools.

Q. How do I remove a failed Exchange Server?

A. This process is a bit more complex than a normal decommission of an Exchange Server. This would involve manual changes to the Active Directory Schema using the ADSIEdit tool. With this tool we can manually remove the server from the schema and clean up the active directory users and computer as well. Any custom DNS entries or network routes must be removed.

Q. How do I remove a dead Exchange Server from DAG?

A. From a Database Availability Group (DAG) one must ensure that the server is evicted from the Cluster and any databases which were passively copied to the dead server are removed. The other steps would be like removing a failed Exchange Server.

Q. How to install Exchange Server step by step?How to fix error- Exchange Server is in Inconsistent State?

A. For this process one can try to run the Exchange Server installation in the recovery mode using the same server name and using the same Active Directory objects by running the setup.exe with the following parameters and switch. Setup.exe /m:RecoverServer. The other solution would be to delete the current Active Directory Object of the Exchange Server and retry the installation.

How to Install Exchange server using unattended mode

A. To install unattended mode, it means that the server is installed without any intervention from the user or admin. One would need to run the setup.exe with the following commands.
Setup.exe /IAcceptExchangeServerLicenseTerms /m:install /R:MB
This will install the Exchange Server with the following roles:
– Active Directory Topology Service
– Client Access Service
– Edge Transport Service
– Hub Transport Service
– Mailbox Service
– Management Service
Of course, this would depend on the version of the Exchange Server one would be installing.

Related Post