Restore Exchange data from PowerShell

Working with mail backups can be a pain. Especially when you need to do some kind of bulk operations like scan backups for particular mailboxes and find all emails with certain keywords and then export then to a PST or add them to a public folder.

Quest has recently PowerShell-enabled its Exchange/Notes/PST backup/recovery product – and we got a lot of great functionality available for your scripts/command line.

Here are a few examples:

  • Here’s how you can attach a standard Exchange backup and retrieve its messages as .msg files:

Attach-RMEExchangeDB -EdbPath "C:\Data\Edb\EdbSearchTest\EdbSearchTest.edb" | Get-RMEMessage | Export-RMEMessage -ExportPath "C:\Data\Exported\Msg" -Type Msg

  • Or look for particular keywords in Lotus Notes data:

Attach-RMELotusDB "C:\Data\Nsf" | Get-RMEMessage -SearchIn Subject, Body -Text "test" | Export-RMEMessage -ExportPath "C:\Data\Exported\Eml" -Type Eml

  • Or restore a folder to PST:

Attach-RMEExchangeDB "C:\Data\Edb\EdbSearchTest\EdbSearchTest.edb" | Get-RMEFolder "John Doe\Inbox" | Restore-RMEFolder -TargetPath "C:\Data\Restored\Pst"
Obviously you can restore to live mailboxes and public folders, work with attachments, and so on, and so forth.

Here’s full list of the cmdlets – each of the pages has examples and details on parameters, etc.:

Note that unlike AD cmdlets these are actually a part of commercial product so there is cost involved. You can get a trial license from the product page. If you are a Microsoft MVP you can also get a free NFR license by applying here.

3 Responses to “Restore Exchange data from PowerShell”

  1. 1 nukeitmike July 10, 2012 at 5:00 pm

    Do you happen to know the correct format for the date? I am trying to extract messages between a certain date range, and I am using the below command:
    Get-RMEFolder -Path “$InboxPath\Inbox” | Get-RMEMessage -MessageClass $MClass -TimeAfter $AfterTime -TimeBefore $BeforeTime | Restore-RMEMessage -TargetFolder $RestoreTarget

    When I run this, the MessageClass that I am passing is honored, but not the -TimeAfter and -TimeBefore parameters.

  2. 2 Eugene Fridman July 11, 2012 at 10:32 am

    What version of Recovery Manager for Exchange are you on?

    If it’s version 5.0 or earlier then you also need to specify the -TimeMatch parameter to indicate which time field to search in. The options are sent, received, created, modified, deleted.

    In version 5.1 if this parameter is not specified, received is used by default.

  3. 3 nukeitmike July 11, 2012 at 12:05 pm

    Thanks a million Eugene. I am using version 4.8. That was the parameter I was missing. You just saved me hours of work.

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

My Recent Tweets


The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

July 2009

%d bloggers like this: