Restoring a Mailbox or specific Mailbox data in Exchange

In this post we are going to look at restoring mailbox data in Exchange using PowerShell.

Using your backup software – load the tape or disk backups containing your Exchange databases around the proposed date. Then restore the database to a convenient location with enough disk space.

After that copy over the Database and the Log files to a location on the Exchange server you are planning to preform the restore on.

It is best to make it clear it is a Recovery database, so create a folder called Recovery on the given drive on the Exchange server. Within the Recovery folder create a folder named Database and a folder named Logs. Copy the database and logs to their respective folders.

The file structure should look similar to the image below –

Mailbox restore files

Now using PowerShell Exchange Management Shell –

Exchange management shell

or a PowerShell remote session –

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ExchangeServer/PowerShell/ -Authentication Kerberos -Credential $UserCredential

Import-PSSession $Session

Bring the restored database to a clean shut down state.

Eseutil /R E0A /l I:\Recovery\Logs  /d I:\Recovery\Database

To clarify:

/R = Recovery

E0A = The first 3 letters of the log files

/l = Log file location

/d = Database location

If the command runs successfully, you should see something similar to the below image.

Exchange clean database

Next you will need to create a recovery database in Exchange using the database .edb you have restored. To do this you will need to use/tailor the command below.

New-MailboxDatabase -Recovery -Name Recovery -Server ExchangeServer -EdbFilePath “I:\Recovery\Database\RestoredDatabase.edb” -LogFolderPath “E:\Recovery\Logs

The above command creates the database and calls it Recovery, specifies the name of the server and also the path to the EDB file and the logs.

Microsoft Exchange does recommend restarting the Information Store Service. In this case we are just creating a Recovery database to temporarily mount it for a mailbox restore – therefore you do not need to restart the service.

Next we need to mount the newly created database:

Mount-database Recovery

To verify the mailbox you wish to restore is contained within the Recovery db.

For complete list:

Get-MailboxStatistics –database Recovery | ft –auto

or a specific mailbox:

Get-MailboxStatistics -Database “Recovery” -Filter ‘displayName -eq “NameOfMailbox“‘ | fl

Next you will need to get the GUID of the mailbox on the Recovery database:

Get-MailboxStatistics -Database “Recovery” -Filter ‘displayName -eq “NameOfMailbox“‘ | fl LegacyDN, DisplayName, MailboxGUID

Finally to restore the Recovery mailbox into the current live mailbox you need to do the following command. The -AllowLegacyDNMismatch switch may have to be used if the Source mailbox and target mailbox GUID’s do not match.

New-MailboxRestoreRequest -SourceDatabase Recovery -SourceStoreMailbox “RecoveryMailboxGUID” -TargetMailbox “MailboxRequiringRestore” -ExcludeFolders “#JunkEmail#” –AllowLegacyDNMismatch

Feel free to tailor the command for your requirements, for example if I wanted to restore only the Contacts of the mailbox I would include the  parameter -IncludeFolders, as shown below-

New-MailboxRestoreRequest -SourceDatabase Recovery -SourceStoreMailbox “a84de875-1021-4c14-9d1d-f391f6819883” -TargetMailbox “MailboxRequiringRestore” -IncludeFolders “#Contacts#” –AllowLegacyDNMismatch

To view the status of the restore you can use the below command:


Providing there aren’t other restores running it will show the status of InProgress whilst the restore is processing, to which it will change to the status Completed once the restore has finished.

Once the restore has completed in its entirety. To free up resources it would be wise to remove the database from the Information Store. You can do this by using the below command.

Remove-MailboxDatabase -Identity “Recovery

Completed – you have now restored data from an Exchange mailbox, congratulations!

If you want to know more useful PowerShell commands, check out my ultimate list of usful Exchange PowerShell commands.


Thanks for reading – feel free to follow and stay updated 🙂  View sysadminguides’s profile on Facebook View GuidesSysadmin’s profile on Twitter View 115372466162675927272’s profile on Google+

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s