WinDeveloper O365 Mailer FREE for 1 Year

WinDeveloper IMF Tune
WinDeveloper IMF Tune
  • Home
  • ExMerge
  • Replacing ExMerge by Import-Mailbox and Export-Mailbox

Replacing ExMerge by Import-Mailbox and Export-Mailbox

Alexander Zammit

Alexander Zammit Photo

Software Development Consultant. Involved in the development of various Enterprise software solutions. Today focused on Blockchain and DLT technologies.

Cast your Vote
Poor Excellent

For many years ExMerge provided for importing and exporting of mailboxes to/from PSTs. The Exchange 2007 SP1 cmdlets are now ready to take over the job bringing some improvements, but also disappointing in some areas.

Last month Exchange 2007 SP1 reached its final release stage. This is packed with new functionality, including the highly awaited ExMerge replacement for PST imports and exports.

As discussed in Using ExMerge with Exchange 2007, this functionality was already available through ExMerge. Indeed following that article I received tens of emails confirming that ExMerge was working great with Exchange 2007. However the ExMerge solution is not supported by Microsoft.

Exchange 2007 SP1 now fills this gap through the Import-Mailbox and Export-Mailbox cmdlets. These provide a powerful solution consistent with the Exchange 2007 administration interface that Microsoft is happy to support. Just like ExMerge, the cmdlets allow for advanced operations such as merges and email filtering based on various criteria. Furthermore the cmdlets address one of the most problematic ExMerge issues, the 2GB PST limit.

As soon as we fire export-mailbox to produce our first PST, we are greeted with some bad news:

"You are running on a 64-bit computer. To export to or import from a .pst file, you must be running a 32-bit computer that has Outlook 2003 SP2 or later installed.
At line:1 char:1
+ e <<<< xport-mailbox -identity administrator -pstfolderpath C:\PSTs"

The cmdlets certainly provide advancements over ExMerge. However similar to ExMerge these still suffer from long-winded, trouble prone setup requirements. In fact today we won't discuss the cmdlets usage in depth. Instead we focus on setting-up and satisfying the requirements for the cmdlets to run.

Preparing the Machine

From the introductory error, we already know these cmdlets won't run on the 64-bit Exchange 2007 server. Instead we must setup a 32-bit machine with the Exchange 2007 Management Tools. Many will remember that Exchange 2007 is not supported on 32-bit. However here we won't install a full server. Only the Management Tools are required, a setup that MS does support on 32-bit as well.

So it is time for us to start downloading the 32-bit Exchange 2007 SP1 build. This build includes the complete Exchange install i.e. we don't have to install the RTM version first.

While the download is in progress we will prepare a typical 32-bit XP SP2 machine with all the Exchange 2007 prerequisites:

Next we also need to install the Microsoft Internet Information Services Common Files from the Control Panel Add/Remove Programs applet.

We should now be set to run the Exchange 2007 installation. Here we follow the wizard until reaching the Installation Type selection. At this point we go for a Custom Exchange Server Installation. This allows us to select the exact component to install from which we just select the 'Management Tools' option.

Exchange 2007 Management Tools Installation

Finally we have to install Outlook 2003 SP2 or Outlook 2007. This is probably the most disappointing requirement. If Outlook happens to be in use for other administrative tasks this should be no problem, otherwise smaller shops won't be happy to consume a license in this manner. In return we get the latest Personal Folders Store provider that allows us to beat the 2GB PST limit.

Account Rights

Just like in case of ExMerge it is easy to predict that access rights will be causing most headaches. The account used to run the cmdlets must be assigned:

  1. Local Administrator on the XP machine.

  2. Exchange Server Administrator Role on the target Exchange 2007 mailbox server.

  3. Full access to the mailboxes against which the import/export operation is run.

For this article I created a new user named PSTAdmin. We can normally work with existing user accounts. However if we run into access rights problems, creating a new account helps starting afresh.

Assign the Exchange Server Administrator Role

  1. Open the Management Console, right-click the Organization Configuration and select Add Exchange Administrator.

    Add Exchange Administrator

    Exchange Server Administrator role

  2. Click on browse to select the PSTAdmin account.

  3. Select 'Exchange Server Administrator role'

  4. Click on Add and select the Exchange mailbox server. Here my virtual machine was unimaginatively named 'PCBOX'.

  5. Complete the wizard. This will return a warning saying:

    "To fully administer exchange server, you need to manually add the user or group 'dom1.local/Users/ PSTAdmin' to the built-in local administrators group on server 'PCBOX'."

    From my experience this was not necessary for these cmdlets. If your experience is different please post a comment!

Allowing Mailbox Access

When running the cmdlets against a few mailboxes, we could assign the Full Access permission on a mailbox using the Management Console. This is another Exchange 2007 SP1 addition. To do this, just select the mailbox and select Manage Full Access Permission.

Manage Full Access Permission

Editing the permissions of individual mailboxes quickly becomes unpractical. If performing brick-level backups we will want rights over all mailboxes within the database. Furthermore we don't want to modify the rights for each newly created mailbox. This is when the command shell becomes the best option. These cmdlets will run happily if we assign the RecieveAs right over the mailbox database of interest. In this manner new mailboxes will also be covered.

Get-MailboxDatabase -identity "PCBOX\First Storage Group\Mailbox Database" | Add-ADPermission -user "DOM1\PSTAdmin" -ExtendedRights Receive-As

Here we are piping the results of Get-MailboxDatabase to Add-ADPermission. Add-ADPermission is fed with the account (DOM1\PSTAdmin) for which the extended right Receive-As is to be set.

Receive-As Extended Rights

Running the Cmdlets

We are ready to start running the cmdlets. Here are some simple examples.

Export the mailbox for user1 to d:\temp\user1.pst:
export-mailbox -identity user1 -pstfolderpath d:\temp

Export all mailboxes from the selected mailbox database:
Get-Mailbox -Database "PCBOX\First Storage Group\Mailbox Database" | Export-Mailbox -PSTFolderPath d:\temp\export

Import winfo.pst to the winfo@dom1.local mailbox:
import-mailbox -identity winfo@dom1.local -PSTFolderPath d:\temp\psts\winfo.pst

When running these commands take note of the returned report. The Status Message value will show any error information. The Report File value will return a path to an XML report. This is especially useful when multiple mailboxes are processed. The following image shows a snippet of what export-mailbox returns:

Export-Mailbox Report

Check the References section for more details and practical examples on using these cmdlets.

Troubleshooting Tips

To conclude this discussion I researched some of the errors that may be returned when running these cmdlets.

Server Administrator Role Not Assigned

Without the Server Administrator Role, a user won't even be able to export his own mailbox. Here is what export-mailbox returns in that case:

"The specified mailbox database "PCBOX\First Storage Group\Mailbox Database" does not exist."

Missing Mailbox Access Rights

Once the Server Administrator Role is assigned the user will be able to export and import against his own mailbox. But on trying any other mailbox the command will fail unless the necessary access rights are assigned. The following error is returned in that case:

"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"

Final Tips

The SP1 Import-Mailbox and Export-Mailbox cmdlets filled a gap that for some administrator was wide enough for them to delay the deployment of Exchange 2007. The cmdlets provide improved functionality over ExMerge. However the setup is still as complex as that for using ExMerge with Exchange 2007. This is an area where the Exchange team could certainly do better.


Using ExMerge with Exchange 2007



How to Export Mailbox Data

Exchange 2007 SP1

User Comments - Page 1 of 1

Doug Layton 10 Sep 2012 12:00
This site gave me a lot of great info after I'd struggled with this issue for over a week. I finally created a new account for doing exports, then added the required Exchange roles, and viola' it all worked like it was supposed to work.
Richard 26 Aug 2010 17:53
Great article, sorted my export-issues.

I'd add a command I now use

To export an OU at a time (I move my disabled users for deletion into their own OU)

Get-Mailbox -OrganizationalUnit <name of OU> | Export-Mailbox -PSTFolderPath c:\PST

e.g. Get-Mailbox -OrganizationalUnit MYDOMAIN.COM/USERS/DisabledUsers | Export-Mailbox -PSTFolderPath c:\PST

This might save someone else some time searching
PeteLong 22 Jun 2010 13:20
Nice Article - I've put something similar, along with the most common errors here

Carol Trainor 17 Dec 2009 11:50
Hello, thanks I did that, but didn't see any references to exporting say 3-5 at at time, Bill, Joe, Sue, not 704 users in one spot. Do you think I'll need to do multiples one by one?
Alexander Zammit 17 Dec 2009 11:12

Check this:
Carol Trainor 17 Dec 2009 08:12
Great article and instructions, works like a charm.

What I need to know is the syntax for exporting multiple, but not bulk user mailboxes (from separate containers), such as:

export-mailbox -identity user 1; user2; user3 -pstfolderpath d:\temp.

I tried it with semicolons, commas, neither worked.


Thanks in advance.
Antonie Geerts 8 Dec 2009 07:30
Just a tip for anyone else who cant get it to work using the above instructions:

Make sure that the secondary (and often disabled) Network card on both the exchange and DC is configured with a static IP and local DNS address (yes even though it is disabled).
rana 7 Sep 2009 23:32
thanku for this good explanation but i want to know how to export & import distribution list(group not all the users)
Farhan Naseem 15 Jun 2009 00:07
I want to migrate data from Exchange Server 2007 (32 bits) using SP2 to Exchanger server 2007 (64 bit) using SP2. Can you please tell me how can I do that ?
Alexander Zammit 20 May 2009 11:49
Yes, you can install it on W2003 server as long as Exchange is not installed on the same machine.
Marty Flockhart 20 May 2009 10:23
Is it possible to run this on Server2003 instead of XP Box?
Ryan Parlee 19 May 2009 17:13
I found out the hard way that Installing Outlook 2007 on a 32bit machine that is also our BlackBerry server BREAKS Blackberry! This is due to conflicting versions of mapi32.dll between Outlook and Blackberry. USE A WINDOWS XP WORKSTATION FOR THESE TASKS!
Alexander Zammit 9 Feb 2009 02:56
Have you tried the following?

Get-MailboxDatabase -identity "PCBOX\First Storage Group\Mailbox Database" | Add-ADPermission -user "DOM1\PSTAdmin" -ExtendedRights Receive-As

VAsHachiRoku 9 Feb 2009 01:38
Do you by chance know if there is away to set the permission on the Server level. I know some of our Administrators can create their own SG's and DB's and most aren't that great powershell. I'd hate to have to continue check the permission on new MB's created.
Manisha 3 Dec 2008 20:31
I am running following cmdlet
export-mailbox -identity md2005dev\aaaa -PSTFolderPath c:\Tp\aaaa.pst
on windows server 2003 machine with exchange 2007 sp1 installed and with all the necessary permissions you specified in the article and I am getting unknown error in approving object with error code -2147221219.

And exchange export log shows

[12/4/2008 10:02:09 AM] [0] [aaaa] Opening Exchange mailbox.
[12/4/2008 10:02:09 AM] [0] [ERROR] Error was found for aaaa ( because: Error occurred in the step: Approving object. An unknown error has occurred., error code: -2147221219

Any idea?
Alexander Zammit 17 Nov 2008 01:14
Yes there was such a problem. We discussed this here:

The problem was fixed in Update Rollup 2 for Exchange Server 2007 Service Pack 1
KML 15 Nov 2008 18:50
Can you run import-mailbox agaist the pst file created by POP3 account instead of the pst file created by export-mailbox cmdlet?

The import-mailbox cmdlet reports the operation is successful. But no messages are imported.

Can you run import-mailbox with includedFolders '\inbox'? It does not work for me.

Eric M. 28 Aug 2008 21:17
Thank you for the information. I was having a lot of problems tonight with the following error: "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" In the end I built a new VM to attempt the import-mailbox command with. This time I edited my MSP for Office to remove the Auto-Populate Exchange settings and I could finally import e-mail again. So I would say that the above error is for rights and you will get this error if you install Office/Outlook with the customization wizard that populates the Exchange settings.
Rob 14 Aug 2008 08:46
What kind of questions? Are you supplying the cmdlet all the necessary parameters? If you don't, you get prompted to fill in the missing info.
Jerry 14 Aug 2008 07:01
Thanks for the setup instructions I put it on a Windows 2003 server. I tried doing running a export of all mail boxes and am getting messages that need to be answered is there a switch to turn these off. I would like to write a script to do a nightly export if there are any suggestions.
Ben 12 Aug 2008 08:43
Also for what its worth if I try the same command replacing enddate with startdate it does work though it only exports the new items where I want to export only older items. I really don't see what could be wrong as it clearly can't be permissions.
Ben 12 Aug 2008 08:16
Hey LordPan, I do check the site once in awhile in hopes someone has figured it out. Between here and a couple posts on technet forums I've gotten a few tips but no solution yet (few others with the same issue). I thought when I read your post that it totally could be that as it wasn't something I tried but unfortunately I just tried it again with: export-mailbox -id user -enddate 01/01/2008 -pstfolderpath c:\temp\user.pst but got the same error as before ( -1056749164)
LordPan 11 Aug 2008 01:59
Ben, I don't know if you read this here anymore, but the sollution is probable this: If your computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2006 to specify March 1, 2006. so try to use 4 digits for the year
Sanjay Singh 16 Jul 2008 10:27
Great article - complete in all respect. I would not have done my task of creating PST files for all mailboxes for archival purposes.

Many Thanks!

Long --- Many Thanks 12 Jul 2008 19:29
Without your article, I will be in deep water for many years.

I used the exmerge to export my user folders from Exchange 2000 and used the import-mailbox to bring them into the Exchange 2007 running of X64.

Thank you so much...
Ben 10 Jul 2008 11:43
Not sure if you're still reading these comments but I've run into a bit of an issue trying to export-mailbox using the command Export-Mailbox -id user -enddate "01/01/08" -includefolder "\inbox" -PSTFolderPath c:\temp\user.pst . I'm getting the error:ID no: 00000000-0000-00000000, error code: -1056749164 anyway almost all the posts I see on the net seem to indicate this is a permission issue however if I remove -enddate then it successfully exports the mail. Any thoughts on that one?
Craig 14 May 2008 10:02
Many tnanks, Alexander. Indeed, somehow I had not installed the SP1 management tools as you suggest, just the Ex2007 version. Following your instructions again, it now works perfectly using:
Get-Mailbox -Database "EXCHANGE\First Storage Group\Mailbox Database" | Export-Mailbox -PSTFolderPath "D:\PST\Day1" -Confirm:$false
Alexander Zammit 1 May 2008 13:28
I believe you did not install Ex07 SP1 on the 32-bit machine (from where the cmdlet is being run).

SP1 must be installed on all machines where EX07 is installed.

Ex07 RTM did not include support for PSTFolderPath.
craig 1 May 2008 10:09
I have 2 x W2003 servers. One x64 bit running Exchange 2007 SP1, one 32 bit.

I have installed Powershell and Exchange Management Shell on 32 bit server,
and I can successfully retrieve a list of all Exchange users/mailboxes by
running "Get-Mailbox" on the 32-bit server.

However, when I try and export all mailboxes to a PST file, I get:
"Export-Mailbox : A parameter cannot be found that matches parameter name

I have tried many variations of the command as follows, to no avail:
"get-mailbox | export-mailbox -PSTFolderPath:'D:\PSTfiles' -Confirm:$false"

Robin 1 Apr 2008 08:45
You say that this is an area where the Exchange team "could have done better". You're assuming that the primary role of this team is to make administration tasks straightforward, minimise support overhead & so on.

This way one needs an additional machine running Windows, with a copy of Exchange Server Tools, and a copy of Outlook. And after you've done all of that setup work, documented it and so forth, you'll be needing some more Exchange administrators to keep things running. So it becomes more entrenched in the organisation (it's obviously too late by the time you discover this sort of thing, amazingly enough it doesn't seem to be mentioned in the long list of extra features).

Would you like a copy of SharePoint while you're at it, to replace all the useful bits of Public Folders that got taken out of Exchange 2003?

I'd argue that from the point of view of Microsoft's shareholders the Exchange team are right on target.
Ramiz 8 Mar 2008 18:57
Very well written article, thanks for explaining step by step this process, I read a lot of articles but none of them mentioned that you need to have framework 2.0 with sp1 and also Exchange 2007 sp1 installed on the x32bit server. Thanks again
Alexander Zammit 20 Jan 2008 14:14
Yes here is an example quoting from:

"To import mailbox data from .pst files that are located at C:\PSTFiles into all the mailboxes whose user accounts are in the organizational unit named Students, run the following command.

Get-Mailbox -OrganizationalUnit Students | Import-Mailbox –PSTFolderPath C:\PSTFiles\"
moyon.patrick 20 Jan 2008 03:11
Thank you very much for all these informations about import .pst file. Is it possible to read a file (instead of a user) to import several mailboxes to Exchg 2007 ? Or another way to load 1000 .pst in Exchg2007 in one shot !

Thank you.
Patrick Moyon France
Copyright © 2005 - 2024 All rights reserved. is not affiliated with Microsoft Corporation