Exchange Server 2007 Export Mailbox task

Published 11-28-2006 08:23 PM 33.3K Views

Exporting Mailbox Content

Export-Mailbox is a task developed by the migration team to allow Administrators to export content from active mailboxes to a folder inside other active mailboxes. The initial idea for this task was to be a complete replacement for ExMerge. The implementation of some of this functionality was problematic and it required more time than initially planned. In this post I will describe what we are missing, which workarounds are available, and some of our future plans.

The need for an ExMerge replacement

ExMerge is a tool created by Microsoft Support in the Exchange 5.5 timeframe, used to allow Administrators to export and import mailbox content to/from PST files. Over the years this tool became popular since, because of its flexibility, it could be used in a number of scenarios where specific tools did not exist. As a result of this popularity, the Exchange team took on development ownership of ExMerge for Exchange 2003 and released it as a tool over the web.

Even though ExMerge proved to be a helpful tool for Exchange Administrators, there were several problems that needed to be addressed in Exchange 2007:

  • Separate Code Base: One of the goals for Exchange 2007 is to reduce the number of separate tools and code bases supported for migration operations. ExMerge has always been completely separate from all shared Exchange migration code. This has caused several technical problems like the need to support an independent PST provider (that is why the current version is not able to support mailboxes larger than 2 GB and Unicode) and so on. These issues have caused delays in updates, limited functionality and extra support costs for customers and Microsoft as well.
  • Independent Tool: Besides the technical implications of having a separate code base, the fact that ExMerge is an independent tool has caused a lot of unintended consequences regarding the scenarios where it is used. Every time a tool is used for something it was not designed for the risk of unintended consequences and bugs increase. Also, over use of the Exmerge tool works as an incentive to under use our other migration tools where they are better suited. This adds extra cost to the management of Exchange.


Export-Mailbox was built to address scenarios where mailbox content needs to be copied from one active mailbox to another without actually migrating the whole mailbox object. Source and target servers used by export-mailbox need to be part of a Single Forest or Resource Forests. That is, mailbox content can only be exported to mailboxes within the same forest.

The following versions are supported by export-mailbox:

  • Source Server:
    • Exchange 2000 SP3 (or later)
    • Exchange 2003 SP2 (or later)
    • Exchange 2007
  • Target Server:
    • Exchange 2007

Exchange Permission requirements:

  • Logon account for the user who is running Export-Mailbox needs to be a member of "Exchange Servers Administrators" for source and target Server. Permissions for previous Exchange Servers remain the same as they were for Exchange 2003 Move Mailbox Task (Exchange Administrator).

Current functionality available for Export-Mailbox

Pre-Validation and New and Improved Logging

Export-Mailbox benefits from a pre-validation functionality similar to the one present in move-mailbox. This feature saves time by identifying most errors right away before the export begins, instead of waiting until they happen during an actual export.

Also available for Export-Mailbox is the comprehensive log feature: Event logs, a XML Report and a troubleshooting log. All logs are enabled by default and are located at <ExchangeRoot>\Logging\MigrationLogs\.

Export-mailbox available options

  • Export mailbox content from a active mailbox to a folder inside another mailbox
  • Filter content to be exported based on:
    • List of included or excluded Folders (included using –IncludeFolders or excluded using -ExcludeFolders)
    • Message subject (-SubjectKeywords)
    • Message and attachments content (-ContentKeywords)
    • Attachment file names (-AttachmentFilenames)
    • Message locale (-Locale)
    • "OR" search of Message subject, message content and attachment content (-AllContentKeywords)
    • Date range (-StartDate and –EndDate)
  • Delete content from source mailbox after exporting it to target mailbox
  • Automatically exports dumpster items as regular messages in the target mailbox

Features postponed

The following options were not included for Exchange 2007:

- Exporting content directly to a PST file: Part of the challenge here was to adapt our code to the Outlook PST provider, which provides the most up to date PST functionality. Currently Administrators can export content to folders inside one or more mailboxes and then manually export this content to PST files using Outlook. Also, Exchange 2007 will not actively block access from ExMerge clients supported by Exchange 2003. This is not a scenario officially tested but customers have reported that running ExMerge from an Exchange 2003 server and accessing Exchange 2007 databases indeed works. Native Exchange 2007 support for this PST is being planned to be part of Service Pack 1.

- UI interface: Since most of the common scenarios for ExMerge were related to bulk operations we have decided to focus on delivering the needed functionality first and a GUI later. There is no defined date for the creating of such interface for the export-mailbox task at this point.

Customer scenarios and examples

These are the supported customer scenarios for Export-Mailbox:

  1. Exporting mailbox content during litigation process

During a litigation process, Administrators may need to regularly export mailbox content from selected users. These searches will be based on criteria defined by lawyers. This content will be exported from one or more source mailboxes into a temporary mailbox that the lawyers can access. The lawyers would then process the data and send the data to opposing counsel.

  1. Exporting email content to former users

When accounts are about to be removed from a server (as in college students graduating or users leaving a hosting account)administrators might want to send mailbox content to the former users that for some reason could not manually copy the email content themselves. Admin would use the Export-Mailbox option to export the data to some intermediary mailbox and then manually export data to end users via PST files.

  1. IT Emergency Response Process

In the course of daily operations of an IT Emergency Response organization, administrators need the ability to scan a large number of messages based on specified criteria, and perform mass deletion of any suspect email found. By using Export-Mailbox and the –DeleteContent parameter along with specific filter options, they are able to search and delete such messages.

Export-Mailbox examples:

Exporting mailbox content based on Organizational information:

Export all content from all mailboxes where user Title starts with VP to a folder called VPData in the Administrator mailbox:

Get-user | where { $_.Title -ilike "VP*" } | export-mailbox -TargetFolder "VPData" -TargetMailbox Administrator

Export all content from all mailboxes from the Accounting department to a folder called AccountingData in the Administrator mailbox:

Get-user | where { $_.Department -Eq "Accounting" } | export-mailbox -TargetFolder " AccountingData" -TargetMailbox Administrator

Using filtering when Exporting mailbox content:

Export all content from UserMailbox1's mailbox received between 02/02/05 and 02/05/05 to a folder called User1Data in the UserMailbox2's mailbox:

Export-mailbox -id UserMailbox1 –StartDate "02/02/05" –EndDate "02/05/05" -TargetFolder 'User1Data' -TargetMailbox UserMailbox2

Export all content from the Sent Items folder of UserMailbox1's mailbox to a folder called User1SentItems in the UserMailbox2's mailbox:

Export-mailbox -id UserMailbox1 -IncludeFolders "\Sent Items" -TargetFolder ' User1SentItems' -TargetMailbox UserMailbox2

Filters out content from the Deleted Items folder and only exports messages that are in Japanese to a folder called User1JapaneseItems in the UserMailbox2's mailbox:

Export-mailbox -id UserMailbox1 -ExcludeFolders "\Deleted Items" -Locale ja-jp -TargetFolder 'User1JapaneseItems' -TargetMailbox UserMailbox2

Using filtering to Export and delete mailbox content:

Export and delete all messages that contain "Confidential" in their subject from all mailboxes from the DB1 database to a folder called ConfidentialData in the Administrator mailbox:

Get-mailbox -database 'DB1' | export-mailbox –SubjectKeywords "Confidential" -TargetFolder "ConfidentialData" -TargetMailbox Administrator –DeleteContent

Export and deletes all messages that have an attachment that contains the word "movie" in its name from all mailboxes from the DB1 database to a folder called MovieAttachmentMessages in the Administrator mailbox:

Get-mailbox -database 'DB1' | export-mailbox –AttachmentFilenames "movie" -TargetFolder "MovieAttachmentData" -TargetMailbox Administrator –DeleteContent

Export and deletes all messages that contains the word "virus" in its body or in its attachment body from all mailboxes from the DB1 to a folder called VirusMessages in the Administrator mailbox:

Get-mailbox -database 'DB1' | export-mailbox -ContentKeywords "virus" -TargetFolder "VirusMessages" -TargetMailbox Administrator –DeleteContent

- Paul MacKnight

Not applicable
so export-mailbox cant move maiboxes from 5.5 to ex07 ? in this case we will need to move the mailboxes to ex2000 or ex2003 to be able to move them to ex07 right ?
Not applicable
Does this mean that you cannot export the contents of one mailbox to the same folder structure in another?  It sounds as though it can only be sent to a single folder within the new mailbox.

Also, can it move things like rules, appointments, tasks, etc.?  Or is it strictly limited to mai items?
Not applicable

That is correct - give it a day or two, we are comung out with a post that goes over 5.5 to 2007 migrations using native tools.
Not applicable
You cannot copy exactly the folder structure because we time stamp the top level folder where the content is exported to. We also don't export associated folder messages because they would not work on the target mailbox in any way.

You should keep in mind that Export-Mailbox is not intended to be a migration tool (this is done by move-mailbox).
Not applicable
Is there a functionality using export-mailbox to dump to a PST file?   While not really practical in a large environment, I do personally (on my home Exchange) like to dump to PST and do database backups.   In 2003 I just had a scheduled ExMerge job that dumped my mail to a PST and an NTBackup job to get the database.

I ran "help export-mailbox" but did see this scenario.
Not applicable

This is something we are working on. The plan is to have it available in SP1.

Not applicable
Not being able to dump directly to a PST file is a problem.  As in the example you list, we use Exmerge to dump the mailboxes of all of our graduating students each semester to PST files so they can take their mailbox with them when they leave.  I don't relish the idea of keeping a 2003 around server just for Exmerge.   Any tips on automating this for hundreds of users with Outlook?
Not applicable
Very cool and a good start but given the way exmerge is used this falls really short of the mark.

Export to .PST is essential for archiving mailboxes when accounts are remove - we regularly do this for all the vast majority of our customers.

The guidance that we will be sending to our customers is Exchange 2007 isn't complete - wait for SP1.  

Not applicable
How about adding the options for locating information also based on To:, From:, Bcc, CC fields?
Not applicable
We are definitely working on PST support. However, if this is your only blocker you can still use ExMerge and deploy Exchange 2007 now.

We are also looking into adding more filtering options, and the ones you mentioned are on the top of our list.

Not applicable
what about security implications? in a large organization, where many people might have exchange permissions or exchange administrator accounts, this kind of intrusion would be very hard to track.
The fact that the only way to trace it would be the xml log and (if activated) the audit log - which both can unfortunately be tampred with if you have the permissions to perform "export-mailbox" anyway.
this extremely powerful feature, if handled by someone with a clue, could be pretty untraceable (even assuming you knew it happened).
Not applicable
We really need a GUI version of this. Our lower level Exchange Admins do not understand anything else.
Not applicable
I have previously listed the progress we've been making in posting ITPro focused Systems Management blog
Not applicable
Guys, this is totally crazy that we cannot export mail from one mailbox to another mailbox without going to a 2nd level folder.  This is going to be a major show stopper. We are currently doing a design for a major entertainment company and they are now re-considering the project because they constantly ExMerge data around now.  This cannot wait for SP1.  Please help us!
Not applicable
Hi webteam

Could you give us some more details around what you are trying to accomplish and why having the email in a 2nd level folder is not acceptable? How was ExMerge used in this case?

Not applicable
I am supporting Exchange for a large outsourcing company.
~6-7 clients 40-50 servers ~50K users. Exmerge is by far the most widely used tool. 3 of our large clients are still on 5.5, some with single server small sites where we could sell them on the idea of migrating to a brand new 2007 organization with exported/imported mailboxes.
But wait! WE cannot! We do not have the tools!
Exchange Server 2007 is yet another example of the sloppiness of Microsoft; releasing a software two years before it is ready for production use.
Our message will be loud and clear: stay away from it for at least two years.
Even though this is definitely not the first time, I still feel disappointed beyond my ability to express it
Not applicable
Zork Hun,

While Exmerge is not supported against Exchange 2007 server, it will run (as long as there is a public folder store on Exchange 2007 server). You know best when something is ready to be deployed for your specific scenario and customer, but it should be understood that if you have an Exchange 2003 ESM installed (for DLLs Exmerge depends on), Exmerge will run and happily connect to Exchange 2007 server. We are working on a supported Exchange 2007 solution too.
Not applicable

Thanks for the detailed info.

I was looking for the "export to pst" solution because I plan to use it as a brick level backup in addition to store backups.
(My backup software isn't Exch2007 compabible yet).

I would like to ask:

1. What are the permissions required to run Exmerge against an Exchange 2007 server?

2. Would you consider releasing an Export-Mailbox update (or Exmerge update) which would allow us to export from Exch2007 directly to PST, without waiting for SP1?

Yizhar Hurwitz
Not applicable
Typical - Microsoft is always sticking it to people.  Without Exmerge, it took my guys 19 hours to export email in a disaster recovery situation.  It would have taken JUST ME about 6 hours to do the same thing if an exmerge equivalent had been included in the Exchange 2007 final product.

Thanks for taking away one of the most useful tools in the Gold Partner arsenal.  Not only is the product not installing properly in production environments that are not 100% pristine (pretty much just lab environments), and not only do I have lots of trouble moving mailboxes BACK to a 2003 server, but you remove my exmerge, so I could not just dump a company out to .PST files, blow up everything, and rebuild a pristine environment from scratch.  Typical Microsoft - thinking with your butt instead of your brain.
Not applicable
Le SP1 d'Exchange Server 2007 devrait voir le jour durant le second semestre 2007. Voici une liste des
Not applicable
I don't see a way to export based on EXACT string match the way exmerge was able to before.  Is something that will be addressed?
Not applicable
I need to search an ex2k7 database and export messages containing a specific person's name in the body or attachment.  My export command works, but it also returns all messages that have that name in the recipient list.  This is too much info and is not what I need.
Here is my cmd:
get-mailbox -database "serverAsg2mailbox store" | export-mailbox -targetmailbox testmb -targetfolder restore4 -contentkeywords "alice" -excludefolders "contacts", "calendar", "journal", "notes", "tasks", "junk e-mail" -baditemlimit 1000
Version history
Last update:
‎Jul 01 2019 03:21 PM
Updated by: