Goodbye Exchange ExMerge, Hello Export-Mailbox

ExMerge was a great way of exporting a mailbox to an Exchange PST file, or for removing all occurences of an email virus, but it has now been replaced by two new Exchange Management Shell cmdlets, Export-Mailbox and Import-Mailbox which are equally as useful to have at hand.

Most Exchange administrators who’ve worked with Exchange prior to Exchange 2007 will be familiar with ExMerge.  It was a useful tool to have available if you needed to export a mailbox to a PST file, for example if a user left and wanted to take a copy of their mailbox with them, or you needed a PST file as an archive copy of one or more mailboxes.  It was also useful if you needed to search your Exchange databases for a particular message and remove it, such as removing an email virus.

ExMerge was born in the Exchange 5.5 days as a product support tool, and was later re-released for Exchange 2003 as a web download.  In Exchange 2007 ExMerge has been replaced by two new Exchange Management Shell cmdlets, Export-Mailbox and Import-Mailbox.  The RTM release of Export-Mailbox was limited to moving messages only from one mailbox to another, but the SP1 release was enhanced to include the export-to-PST functionality which is familiar to ExMerge users, and that’s the version I’m referring to in this article.  There is no graphical interface for either Export-Mailbox or Import-Mailbox; they are only available in the shell.

It’s important to note that Export-Mailbox is not intended for use as an Exchange migration tool.  It’s designed for moving mailbox content rather than an entire mailbox.  If you need to migrate an entire mailbox you should use the Move-Mailbox cmdlet.

At a high level, Export-Mailbox can be used to

  • Export mailbox content from a mailbox to another mailbox
  • Export mailbox content from a mailbox to a PST file

During mailbox exports content can be filtered by:

  • Included or excluded folders
  • Message sender keywords
  • Message recipient keywords
  • Message subject keywords
  • Message and attachment content keywords
  • Attachment file names
  • Date range

If you’re going to use the filter options, make sure you have at least Update Rollup 4 for Exchange 2007 SP1, as this update included improvements to the filtering options.

When keyword filter options are specified Export-Mailbox will first export all the messages in each from the source mailbox to the destination mailbox. The folder in the destination mailbox is then searched and messages which do not match the keyword filters are deleted.  On large mailboxes this can be a time consuming and resource intensive operation.

Other options are available to:

  • Merge content from the source to the destination (the top level folder is not time stamped)
  • Delete content from the source mailbox after it has been exported
  • Include associated messages such as rules, views, and forms
  • Increase the number of threads
  • Write output to an XML log file

The source and destination mailbox must be located on one of these versions of Exchange:

  • Exchange 2007
  • Exchange Server 2003 SP2 or later
  • Exchange 2000 SP3 or later

Export-Mailbox will export any items in mailbox’s dumpster by converting  them back to regular messages. 

For multiple mailbox exports, the output of the Get-Recipient or Get-Mailbox cmdlets can be piped to Export-Mailbox.  When piping input to Export-Mailbox, the MaxThreads parameter can be used to increase the number of mailboxes processed simultaneously.

Copying mailbox content to a subfolder in another mailbox

This might be the case if you have a user who has left and you need to move some or all of their mailbox content into the mailbox of another user such as their co-worker, manager, or replacement, before the leaving user’s mailbox is deleted.

This is the command to export the content from Joe’s mailbox to a folder name “Joe” in Bob’s mailbox:

The exported content will look like this:


Optionally the AllowMerge parameter can be used to merge the content into the target folder. When using the AllowMerge parameter the top-level folder isn’t time-stamped, this means that the source mailbox content can be exported to the destination multiple times:


Specific folders can be included or excluded by using the IncludeFolders and ExcludeFolders parameters. For example, to include only the Inbox and Contacts folders:

To export all content except for the Sent Items and Deleted Items folders:

Exporting mailbox content to a PST file

If a user is leaving and wants to take a copy of their mailbox you can use Export-Mailbox to move the data directly into a PST file.

Tip: To export mailbox content to a PST file you must run Export-Mailbox on a 32-bit Windows computer running the 32-bit version of the Exchange 2007 management tools, and Microsoft Outlook 2003 SP2 or later.

To export a user named Joe’s mailbox to the PST file C:\Temp\joe.pst:

To export all the mailboxes in the sales mailbox database to individual PST files named <alias.pst>:

Searching for and removing content from a mailbox

If a virus has found its way into your Exchange organisation, or if a message has been delivered to a large number of mailboxes and you need to remove it, you can use Export-Mailbox to search mailboxes and remove the message.

Tip: Because Export-Mailbox first copies all content to the destination mailbox before performing the search the target mailbox can get quite large and will have a lot of IO.  It’s a good idea to use a mailbox created specifically for this task, especially if you are performing the search over many mailboxes and using the MaxThreads parameter to increase the default number of threads.

To remove any message with the words “Company confidential” in the subject line from all mailboxes on the server EXCHANGE01, processing 10 mailboxes at a time:

To remove any messages from the sender from all mailboxes on the server EXCHANGE01, processing 10 mailboxes at a time:

The messages will be copied to the “MessageCleanup” folder in the target mailbox and deleted from the source mailboxes.  The target folder will include a replica of the folder structure in each of the source mailboxes.


Troubleshooting Export-Mailbox

The most common problems with using Export-Mailbox are related to permissions.  To use Export-Mailbox you need to be delegated the Exchange Server Administrator role, be a member of the local Administrators group for the target server, and have full access to the source and destination mailboxes.  The source and destination mailboxes must be in the same Active Directory forest.

These are some common permissions-related errors:

Error Cause

“The specified mailbox database [Mailbox Database Name] does not exist”

 The user running the Export-Mailbox command needs to be delegated the Exchange Administrator role for the Exchange server.

“Error occurred in the step: Creating target folder in the target mailbox. An unknown error has occurred., error code: -2147221233”

The user running the Export-Mailbox does not have full access to the destination mailbox.

 Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store

 with error:

MAPI or an unspecified service provider.

ID no: 00000000-0000-00000000, error code: -1056749164″

The user running the Export-Mailbox does not have full access to the source mailbox.

ExMerge may be gone, but Export-Mailbox is equally as useful a tool to have at hand.  The flexible filtering options make it possible to do more granular exports than were possible with ExMerge, and the command shell interface makes it easy to script.

More information on Export-Mailbox can be found on the Microsoft TechNet website:

More information about the dumpster can also be found on the TechNet website:

Tags: , , ,


  • Rate
    [Total: 3    Average: 4/5]
  • Anonymous

    Your are doing good job.I thankful to you.

    This document for very usefull for us.

    Thanks & Regards

  • Troyw

    Exmerge and Export Mailbox
    Excellent article, however, IMHO the exmerge and export-mailbox capabilities to be a bit troublesome and wanting. Instead we use the DigiScope product since it has a cool gui and can search, slice and dice, recover and export data from Live Exchange Servers as well as offline EDBs

  • BobMaria

    For exporting your mailbox to PST
    Good article but there are also some softwares for exporting EDB files to PST files.
    You can try –

  • jmartin95

    Some of us have to be cheap
    I think the point of the article is what can you do with the exchange software you just purchased without the additional cost of $500 – $750.

    I dont know what could be easier than entering a command into the management shell…pretty easy if you ask me. easier on the wallet too.

    Great article. Thank you

  • shawninc

    Exporting Exchange Mailboxes to a PST

    1) Download “ExMerge” on to a Windows 2003 server with Exchange running on it.
    2) Copy “exchmem.dll” to the folder with the “ExMerge” contents.
    3) Give full perms to administrator or the user you logged in as to the server and mailboxes.
    a. In Exchange Manager, right click in server, properties and then security
    b. Uncheck inherit
    c. Add everyone, and give full control to everyone.
    d. Take ownership
    This ensures that you have the require “send as” and “receive as”, but the step here are very insecure. While this is insecure, it does effectively allow a mailbox backup or each user for a system that is about to be decommissioned.

    <a href=””>Shawn Z</a>

  • SZZ

    missing the good old exmerge
    I do like the new mailbox migrating tool, only it is not working for me. Below is the error message that I am getting and will appreciate is you can suggest a workaround.
    ————–start of error message————
    Error occurred in the step: Moving messages.
    This mailbox exceeded the maximum number of
    corrupted items specified for this move mailbox operation.

    D:Program FilesMicrosoftExchange ServerLoggingMigrationLogsexport-MailboxXXXXX.xml
    ————-end of error message—————-

  • kottees

    Exporting Exchange Mailboxes to a PST
    Great!! it worked like a charm!

  • luisbob

    Re: export mailbox to pst
    There’s no doubt about the new tool, It is much better than the old relatively limited and error prone Exmerge.exe utility. There are also some third party tools which allow the users to export mailboxes to .pst files from both Online and Offline Exchange databases i.e. there is no need to stop the Exchange server before running the tool. One such tool is Stellar Phoenix EDB to PST Converter that supports all versions of MS Exchange Server and quickly exports all or a single Mailbox to .pst file. For detailed information, you may visit here:

  • coamiked

    thanks Ben
    Thanks Ben…I know this article is a few years old but it is still informative. Pull my — out of a bind. Keep up the good work


  • curtissw

    Run the command on the top level folder and not the subfolders?

    I am running this script below and it works fine except for it not only delete’s the files in the inbox but in the subfolders as well. Is there a way to have it just delete the items in the inbox and not the subfolders? I already tried the -ExcludeFolders command and it does not allow both. We already use the built in manage folders for something else and it looks like you can only create one rule per folder.

    $today = (get-date).AddDays(-15).ToString("MM/dd/y")
    Export-Mailbox -Identity “general" -IncludeFolders "inbox", "sent items”, "deleted items" -EndDate “$today" –DeleteContent -Confirm:$false

  • adom503

    Great Blog with Simple Steps
    Nice steps are here for exporting mailboxes from live exchange to pst. I searched a blog that also saying for exporting mailboxes from offline edb to pst. Read here:

  • suzainsmith

    Rapid way to Export Exchange Mailbox to Outlook PST
    There is one more tool that is prevalence from the named as Exchange EDB to PST Software. This Exchange EDB to PST Recovery Tool elegantly repair orphaned Exchange EDB file database without missing a single file of Exchange EDB. This Software rapidly export Exchange EDB to PST with its all attachments.
    Get this tool from here-

  • kalengarbo

    Best tool to recover EDB file to PST
    If you are still unable to recover EDB to PST then I suggest you best EDB to PST recovery tool because I got excellent experience with this tool. This is professionally works on EDB file and convert exchange EDB to Outlook with all EDB folders.

    Get more info…………

  • shaw1448

    Another option to tackle the Exchange error
    Thanks a lot for the highly informative post. But I have a doubt in my mind relating to novice users. I guess despite you mentioned all the steps very clearly still we cannot expect 100% accuracy from the user. Hence in this condition they can choose any reliable third party Exchange recovery tool. As far as my recommendation is concerned following are some reliable recovery tools.
    Stellar Phoenix Exchange recovery tool.
    Exchange recovery tool from Kernal.

  • ratnankur sharma

    Hi Ben,

    Thanks for the wonderful information!!!

    I would request your inputs regarding my below queries.

    my requirement is to break down the Large Shared Mailbox into multiple Smaller Mailboxes based on the year.

    1.Can we use Export-Mailbox for breaking down large shared mailboxes into smaller ones, lets say based upon the YEAR?

    2.Is this cmdlet always creates the Target Folder on the Target Mailbox and than create folders and subfolders of the source mailbox in it? Actually I need the exact smaller Target clone mailbox of the larger source mailbox based on the year.

    The source and target environments are Exchange 2003/2007.

    Thanks in Advance.