Accidental deletion of a user mailbox, shared mailbox, public folder, or any other item is a common scenario in an Exchange Server environment. When a mailbox is deleted, its associated Active Directory account is also deleted.
But the Exchange Server moves the mailbox to disabled state and retains it in the mailbox database until the retention period expires. So, a deleted mailbox can be easily restored if the retention period is not over. In this article, we will be discussing the methods to restore Exchange mailbox, if it is in the retention period (soft-deleted mailbox) and when the retention period is over (hard-deleted mailbox).
Methods to Restore Exchange Mailbox
First, you should check if the mailbox has been deleted recently, i.e. soft-deleted mailbox. This mailbox can be recovered from the Exchange Server within 30 days. If the 30-day period is over, the mailbox will be deleted permanently, i.e. hard-deleted mailbox. Let’s see how to restore soft-deleted and hard-deleted mailboxes in Exchange Server.
Restore Soft-Deleted Mailbox
A mailbox is attached to an Active Directory User/Object. When a mailbox is deleted, it will be disconnected from the AD user. To restore the deleted mailbox, you need to attach it to a new user or recover the user from the Active Directory Recycle Bin. Here are the steps to connect the deleted mailbox to the user:
Note: The user running the process must have the Recipient Management Role.
- Log into the Exchange Admin Center.
- Click on Recipients and then click on Mailboxes.
- Click on Connect a mailbox and choose the mailbox to restore.
- Choose the user to assign the mailbox to.
- Reconnect the mailbox.
You should check the Recipients section to confirm that the mailbox has been re-connected to a user. The user will be able to access the mailbox.
Alternatively, you can use the Connect-Mailbox PowerShell command in the Exchange Management Shell (EMS) to connect the mailbox (see the below example).
Connect-Mailbox -Identity "" -Database "" -User "" -Alias ""
To get a list of disconnected mailboxes, you can use the following command.
Get-MailboxDatabase | foreach {Get-MailboxStatistics -Database $_.Name} | where {$_.DisconnectReason -eq "Disabled"} | Format-List DisplayName,Database,DisconnectReason
Restore Hard-Deleted Mailbox
If the retention period is over, then the mailbox gets purged permanently from the database. This means that you need to restore the mailbox from backup. Here, we will be restoring the mailbox using the Recovery Database (EDB).
First, you need to restore the database file (.edb) from backup into a temporary folder, for example, M:RecoveryDB.
Before starting, you need to remember that the database will be in Dirty Shutdown state. So, you need to use the EseUtil command, as given below, to perform the smooth recovery process.
eseutil /r E01 /l M:RecoveryDB /d M:RecoveryDB
After the command is complete, you need to check the database state by running the Eseutil /mh command (see the below example).
eseutil /mh M:RecoveryDBDBX.edb
The state of database should be Healthy Shutdown.
The next step is to create a new Recovery Database (RDB) and connect the restored file by using the below command.
New-MailboxDatabase -Recovery -Name RDBX -Server EXCH01 -EdbFilePath "M:RecoveryDBDBX.edb" -LogFolderPath "M:RecoveryDB"
This will create a new database using the restored file. You can now mount the database so that it can be accessible by Exchange Server. For this, use the below command:
Mount-Database RDBX
After this is complete, you should have a new temporary user or replacement user created in the Active Directory.
Now, use the below command to restore the database from the Recovery Database (RDB) to the production database.
New-MailboxRestoreRequest -SourceDatabase RDBX -SourceStoreMailbox "User A" -TargetMailbox usera@mydomain.com
If you have an archive mailbox, you can use the below command:
New-MailboxRestoreRequest -SourceDatabase RDBX -SourceStoreMailbox " User A " -TargetMailbox usera@mydomain.com-TargetIsArchive
You can monitor the progress of restore request using the below command:
Get-MailboxRestoreRequest
Once the restore is complete, it is suggested to remove the completed request. For this, run the below command:
Get-MailboxRestoreRequest -Status Completed | Remove-MailboxRestoreRequest
Limitations of Restoring the Mailbox using the Above Native Methods
There are some limitations and challenges when it comes to recovering a mailbox using the native methods. You will not be able to restore a soft-deleted mailbox if the database is not mounted. If the mailbox has been purged due to retention policy, you need to use the Exchange Recovery Database (DB) method.
The Recovery Database (DB) method involves a lengthy process. You need to first restore the entire mailbox database, which will take time. Also, you should have enough space to store the database until the restore process is complete.
There is a risk of human errors when restoring the EDB file from backup. You may restore and overwrite the live database by mistake. So, it’s highly recommended to restore the file on a different drive.
If the smooth recovery fails, the restored database will not be usable. Manual cleanup is required to remove the requests and dismount the Recovery Database (RDB). You should also consider the time-window, if the restore is critical.
An Easy Solution to Restore Exchange Mailboxes
As you have seen, you might face various challenges when using the native methods. To overcome such challenges, you can use third-party Exchange recovery tool to recover the mailboxes. Tools, like Stellar Repair for Exchange, have been in the recovery market from a long time. It can recover purged or deleted mailboxes from the Exchange database files of any version and size. In addition, it can recover user mailboxes, archives, shared mailboxes, and other items from the database file, even it is corrupted. This tool can help reduce the time of recovery and recover from any situation. Other features include:
- Can open databases from any version of Exchange Server.
- Can open corrupted and standalone database.
- Granular export with filtering.
- Export to live Exchange Server database, Office 365, and PST file.
Conclusion
Above, we have explained how to restore soft-deleted mailbox and hard-deleted mailbox using the native methods. However, these methods have some limitations. To overcome these limitations, you can use third-party Exchange recovery tools, like Stellar Repair for Exchange that can help recover deleted/purged items from Exchange database files in the least possible time and without any risk.