daknetworks.com

You are here: Blog Exchange 2013 EDB File Repair and Restore

Exchange 2013 EDB File Repair and Restore

Messing around with EXCHANGE 2013 EDB files can be tricky. It's best to have a plan before you start typing in commands. Here's my cheat-sheet.

 


REPAIR THE EDB FILE & MOUNT RECOVERY EDB

Again from last time, you can do this with StorageCraft. Paying the license is worth the hassle it saves and more affordable than dealing with MS SUPPORT.

MAKE A COPY OF THE EDB & THE LOG FILES
I don't care how you do it, just do it. If it takes 2 hours to do, then wait the 2 hours for the copy to happen. If you have to run to the store to buy a spare HD, then run to the store. !!!DO NOT BE CARELESS WITH THE EDB FILE!!! Rather, perform your work on a working-copy.

$cd e:\exchange-repair\working-copy

CHECK TO SEE THE STATE
$eseutil /mh '.\Mailbox Database FOO.edb'

SOFT RECOVERY
$eseutil /r E00 /l E:\exchange-repair\working-copy /d E:\exchange-repair\working-copy

CHECK TO SEE THE STATE
$eseutil /mh '.\Mailbox Database FOO.edb'

HARD RECOVERY (IF NECESSARY)
$eseutil /p '.\Mailbox Database FOO.edb'
(!!!CAUTION!!!: performing this will render the database with data loss.)

CONNECT THE RECOVRY DATABASE
$New-MailboxDatabase -Server exchange-server-name -Name RecoveryDB -Recovery -EdbFilePath 'E:\exchange-repair\working-copy\Mailbox Database FOO.edb' -LogFolderPath 'E:\exchange-repair\working-copy\recoverylogs'

DISMOUNT THE CURRENT RECOVERY DATABASE
$dismount-database RDB
(There can only be 1 recovery database mounted at any one time. There can be more than 1 recovery datase connected. See the difference between CONNECTED & MOUNTED?

MOUNT THE RECOVERY DATABASE
$Mount-Database RecoveryDB

 


CHECK THE STATS OF THE RECOVERY DATABASE

CHECK THE STATS OF THE ENTIRE RECOVERY DATABASE
$Get-MailboxStatistics -Database RecoveryDB | ft -auto

CHECK THE STATS OF THE CURRRENT USER-MAILBOX
$Get-MailboxStatistics foo.user

CHECK THE STATS OF THE RECOVERY USER-MAILBOX
$Get-MailboxStatistics -Database RecoveryDB | where mailboxguid -eq 24b5b78e-9396-456f-9ece-a5acaeb3e3e7

 


RESTORE MAILBOX FROM A RECOVERY DATABASE

The RESTORE requires DisplayName, MailboxGUID, or LegacyExchangeDN. The most exact is the MAILBOXGUID since the DisplayName can be lengthy with spaces.

GET THE MailboxGUID:
$Get-MailboxStatistics -Database RecoveryDB | ?{$_.DisplayName -like 'FirstNameHere*'} | fl DisplayName,MailboxGuid,DisconnectDate

It will spit out the mailbox accounts that match along with the GUIDs.

RESTORE THE RECOVERY USER-MAILBOX
$New-MailboxRestoreRequest -SourceDatabase RecoveryDB -SourceStoreMailbox 28282f8e-e37b-4965-9dea-4e8658fada43 -TargetMailbox foo.user -AllowLegacyDNMismatch

-see the status of all the requests:
$Get-MailboxRestoreRequest

-see detail status of individual request:
$Get-MailboxRestoreRequestStatistics -Identity "foo.user\MailboxRestore"

-see the detail status of all the requests:
$Get-MailboxRestoreRequest | Get-MailboxRestoreRequestStatistics

-the request hangs around until you stop it. They are not automatically cleared. Only run this when the request is complete.
$Remove-MailboxRestoreRequest -Identity "foo.user\MailboxRestore"

-or remove all the completed requests:
$Get-MailboxRestoreRequest -Status Completed | Remove-MailboxRestoreRequest

 


IMPORT A PST INTO THE EDB

Sometimes a user has the pst from their laptop and you can import that pst back into the edb. Don't worry, by default it doesn't duplicate items.

First, enable the import/export of .pst into a mailbox as it is not turned on by default:
$New-ManagementRoleAssignment -Role "Mailbox Import Export" -SecurityGroup "Organization Management"
-restart EMS (this means shut down your powershell and open it back up ;-))

-import a PST file into a user's primary mailbox
(NOTE: By default, the import checks for duplication of items and doesn't copy the data from the .pst file into the mailbox or archive if a matching item exists in the target mailbox or target archive.)
-you have to use the new-mailboximportrequest command. It requires UNC path (eg: \\exchange-server\foo-folder$). It will not work with an absolute path (C:\foo-folder\recovered.pst). Definitely an oversight.
-create an easy folder (i.e.: c:\foo-folder\)
-share the folder as a hidden share by putting a dollar-sign ($) behind the name (foo-folder$).
-grant full-access to 'exchange trusted subsystem'
(NTFS and Share permissions)

-import the pst:
$New-MailboxImportRequest -FilePath \\exchange-server\foo-folder$\Recovered.pst -Mailbox foo.user

-see the status of the import request:
$get-mailboximportrequest

-see the details of the import request:
$Get-MailboxImportRequestStatistics -Identity foo.user\mailboximport

-the request hangs around until you stop it. They are not automatically cleared. Only run this when the request is complete.
$Remove-MailboxImportRequest -Identity "foo.user\MailboxImport"

-or remove all the completed requests:
$Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest

 


SEE MOVE REQUESTS

Hopefully, the syntax is becoming clearer. Let's see if you know what this is...

$Get-MoveRequest
$Get-MoveRequest | $Get-MoveRequestStatistics
$Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

 


EXPORT PST FROM EDB

If for some reason you need to export a pst from the edb, you can do that too. Again, it can only be done to a UNC (eg: \\exchange-server\foo-folder$). It cannot be done to an absolute path (C:\foo-folder\recovered.pst). Definitely an oversight.

$New-MailboxExportRequest -Mailbox foo.user -FilePath "\\exchange-server\recovery$\foo.user.recovered.pst"
$Get-MailboxExportRequest
$Get-MailboxExportRequest | Get-MailboxExportRequestStatistics
$Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest

 


MAILBOX REPLICATION SERVICE (MRS)

Throttling is done by the MRS. It it configured here:
C:\Program Files\Microsoft\Exchange Server\V15\Bin\MsExchangeMailboxReplication.exe.config

Do not try to mass import/export/move, unless you know what you are doing. The default settings for the MRS will most definitely bite you. The processes will error out and eventually die after 12 hours.

I wouldn't do more than 20 at a time. There's too many switches. Basically, the more you do at a time, the more resources it takes. The more resources it takes, the longer it takes. If you hit 12 hours, the request stalls. Yes, you can configure all of these settings if you really want to.

This is the best resource for more info:
http://thoughtsofanidlemind.com/2014/09/29/exchange-2013-workload-management-controls-mailbox-replication-service/

 


NOTES

  • Transferring from EDB into an empty mailbox is preferred. In my experience, it is much better. In my experience, mailbox to mailbox misses items and pst to mailbox misses items too.
  • If you can, import into a dummy mailbox account so that you can test and approve the contents before you import it into the real mailbox.

Contact Dak Networks

We are not taking on new clients at this time.