How to Export and Import mailboxes to PST files in Exchange 2007 SP1


There might be times when an Exchange Administrator will need to export the contents of individual mailboxes to offline files in order to present specific users with a format that is easily portable and ready to consume using Outlook clients. To fulfill this need Exchange 2007 SP1 will have a new set of features to export and import mailboxes to and from PST files. As I know you will ask – yes, those PST files can be bigger than 2 GB, which was a limitation of Exmerge tool used for this purpose in previous versions of Exchange.

Export/Import to PST Requirements

In order to export or import mailboxes to PST files the following requirements must be met:

  • Export/Import to PST must be run from a 32 bit client machine with Exchange Management Tools installed (Version Exchange 2007 SP1 or later). The 32bit requirement comes from a dependency with the Outlook client.
  • Either Outlook 2003 or Outlook 2007 must be installed on the client machine.
  • The user running the task must be an Exchange Organization Admin or an Exchange Server Admin on the server where the mailbox to export/import lives.

Exporting mailboxes to PST files

The most basic cmdlet to export a mailbox to a PST file is as follows:

Export-Mailbox –Identity <mailboxUser> -PSTFolderPath <pathToSavePST>

PSTFolderPath must be a full path pointing either to a directory or to a (.pst) file. If a directory is specified a PST file named after the mailbox alias will be used as the target of the export. Note that if the PST file already exists the contents of the mailbox will be merged into it.

Example:

After the cmdlet finishes execution, the .pst file will be ready in the specified location:

To export multiple mailboxes to their respective .pst files at once you can pipe in the identities of those mailboxes to the export task. Notice that when bulk exporting the PSTFolderPath parameter must forcefully point to a directory since one .pst file will be created for each mailbox.

Example:

Get-Mailbox -Database ‘MDB’ | Export-Mailbox -PSTFolderPath D:\PSTs

Importing mailboxes from PST files

The process for importing mailbox contents from a PST file is quite similar:

Import-Mailbox -Identity <mailboxUser> -PSTFolderPath <PSTFileLocation>

Again, PSTFolderPath must be the full path to the directory where the .pst file lives or to the (.pst) file itself. In the case where PSTFolderPath points to a directory the cmdlet will try to match the mailbox alias with the name of an existing .pst file in the specified directory and import the content of that file.

Example:

Just as with the export to PST scenario, when bulk importing mailboxes the PSTFolderPath must forcefully point to a directory and the task logic will try to match mailboxes alias with the .pst file names under that location. If no match is found for a particular mailbox, that mailbox will be skipped.

Example:

Get-Mailbox -Database ‘MDB’ | Import-Mailbox -PSTFolderPath D:\PSTs

Filtering content in Export/Import to PST

When only specific content is desired in the PST file (or back into the mailbox) a common set of filters can be used to leave out the rest of the messages. Export/Import to PST support the following filters: Locale, StartDate, EndDate, ContentKeywords, SubjectKeywords, AttachmentFileNames, AllContentKeywords, SenderKeywords, and RecipientKeywords.

Example: Import only those messages that were created between 1/1/06 and 12/1/06 and contain the word “review” in the subject and any of the words {“project”,”alpha”} in the body.

Import-mailbox -Identity ricardr -PSTFolderPath D:\PSTs -StartDate 1/1/06 -EndDate 12/1/06 -SubjectKeywords:’review’ -ContentKeywords:’project’,’alpha’

Now, we realize that you would like to try this today, but please be patient!

Ricardo Rosales Guerrero

Comments (55)
  1. Exchange Exchange Admin says:

    How much bigger than 2 GB?

  2. Exchange says:

    Exchange Admin,

    We use what Outlook provider does, and it seems like currently, it is limited to 20GB:

    http://support.microsoft.com/kb/830336/

  3. DosFreak says:

    Any work on a 64bit version of Office any time soon?

  4. Norah says:

    Does it support archive and multi-language?

  5. Lee Flight says:

    A common Exchange Administrator task for me is the extraction into a PST from a mailbox that is a Recovery Storage Group (RSG) for legal or compliance. Will Export-Mailbox have  -RSGMailbox -RSGDatabase options like Restore-Mailbox?

    Thanks!

  6. Ricardo Rosales Guerrero says:

    Lee Flight,

    Exporting content directly from a RSG database to a PST file is not supported.  To accomplish this task you’d have to first restore the mailbox content to an online mailbox using restore-mailbox and then export the online mailbox to a PST.

  7. Briam says:

    We are doing some testing now on the ExportToPST, but I think I am missing something.  with an account with Org Admin we get:  

    StatusCode -2147221233

    StatusMessage Error occurred in the step:  Approving object. An unknown error has occurred.

    Also, is this the wrong place for these types of questions?  …should I be looking at a forum/technet site for the BETA?

  8. Lee Flight says:

    Thanks Ricardo. Is there anyway to ask that export from RSG be considered as a future addition as there times when it is important that the mailbox go from RSG to PST and not appear in the online mailbox of the active user? The main driver here is for legal/compliance when data is required from a restore that the user may have deliberately deleted but that data needs to be recovered. Currently we do this by restore to RSG and then perform export using Exmerge which is RSG aware.

  9. Ricardo Rosales Guerrero says:

    Norah,

    I guess that by Archive you mean the Archive Folders in Outlook.  Export-mailbox will not export the content of those folders since they are not stored on the server but on the client side.  However, since the Archive Folders are stored as a PST file (generally under C:Documents and SettingsyourusernameLocal SettingsApplication DataMicrosoftOutlookArchive.pst) they can be imported to the server using import-mailbox (as long as the pst file was created with Outlook 2003 or later).

    I didn’t get what you meant by multi-language.  Do you mean multi-language character support?  If so, the answer is yes, export/import support Unicode.

  10. Ricardo Rosales Guerrero says:

    Lee Flight,

    You do not necessarily need to restore the RSG mailbox into its corresponding online mailbox.  You could for example create a new mailbox to hold the recovered content and only grant access to it to the legal department; then export its contents to a PST file.  To restore an RSG mailbox to a "different" mailbox you only need to use two additional parameters:

    Restore-Mailbox -Identity legalDepartmentMailbox -RSGDatabase "Recovery Storage GroupMy Database" -RSGMailbox mailboxToRecover -TargetFolder "Recovered Content"

    Will this work for you?

  11. oldmfors says:

    Is this feature available in the Beta of SP1? Will it be possible to install the Beta on a 32-bit server with exchange management tools and run it without installing the BETA on the exchange server itself?

  12. Lee Flight says:

    Thanks Ricardo. That looks like it will work for us.

  13. Ricardo Rosales Guerrero says:

    Briam,

    Unfortunately this is not the best place for your type of questions.  Could you please open a PSS support case for this?

  14. Tim says:

    Is Import-Mailbox available in the release?   I need it, and can’t seem to find it.

  15. Ricardo Rosales Guerrero says:

    Tim,

    Import-Mailbox is not in E12 RTM, it will be released with the SP1.  It is in E12 SP1 Beta 1 though, if you’re running that beta….

  16. Pat Richard says:

    Any chance the requirement for Outlook might also use

    Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1

    instead? We have to install that as part of Backup Exec, and it seems to me that this might be easier than installing Outlook. Plus, as mentioned previously, how are we supposed to install Outlook 2007 on a 64bit machine?

  17. Dan_IT says:

    Will an import of a .pst to a mailbox also cause that mail to be journaled if the mailbox is part of a journal rule?

  18. It is very unfortunate that the current SP1 beta on MSDN Subscriber downloads is only available as 64-bit version. Because of this we couldn’t use this PST Import feature when we migrated to Exchange 2007, so we had to import all PST files by hand using Outlook. :-( Can you also explain where exactly the 32-bit dependency comes from, since even though Outlook 2007 is a 32-bit application, it will install and run fine on 64-bit Windows! Wouldn’t another option be to run the EMS in PowerShell in 32-bit mode on 64-bit Windows?

  19. MSLover says:

    Can this beta 1 import ANSI coded PST’s in Exchange?

    We seem to have issues importing PST’s not in UNICODE format.

  20. Exchange says:

    MSLover,

    Indeed this should work without problems. Because the import uses the Outlook to do what it does, it works with PSTs no matter how they were created. Of course, you will have to have the mailbox created in order for import to work though.

  21. Betatester says:

    We have a setup:

    Exchange 2007 (RTM) as mailbox server, and have a lot of pst’s…

    We are trying to import all those pst’s without having to setup a temporary Exchange 2003 or third party software.(or import via Outlook)

    We used a 32 bit Windows 2003 server, installed Outlook 2003 and the Exchange 2007 SP1 Management Tools.

    We can successfully execute the import command from pst’s but it wo’nt import anything. Count of items => 0 We tried several pst’s.

    There is no error message, nothing is logged (Eventviewer, or the Migration Logs, not on the migration server or the backend Exchange server)

    However, we can export succesfully Exchange 2007 mailboxes in PST’s. These PST’s can also be imported again..

    Is there a difference between the PST’s (generated by Outlook 2003 and the Exchange 2007 SP1)?

    I know this is beta software, I haven’t found what is wrong with these pst’s.

  22. matthias says:

    Dear all

    And what I have todo for running as scheduled task

    – no confirmation questions

    – Running Powershell from scheduled task

    Thanks in advance

    Matthias

  23. Ricardo Rosales Guerrero says:

    Mattias,

    Export and Import to PST are indeed available in SP1 Beta1 and it is possible to run these features on a SP1 admin only box against a E12 RTM server.

  24. Ricardo Rosales Guerrero says:

    Gerard van der Land,

    We have a 32bit dependency because Outlook is a 32bit only application.  When you install Outlook on a 64bit machine you’re really using WOW64 (Windows-on-Windows64) which can be tought of as a translation layer between the 32 and the 64 bit worlds.  Unfortunately Exchange 64bit dlls cannot load Outlook’s 32-bit dlls from WOW64.

  25. Ricardo Rosales Guerrero says:

    Matthias,

    Running a scheduled task is a two step process:

     1) Create the powershell script and save it as a .ps1 file.  E.g:

         get-mailbox | export-mailbox -PSTFolderPath:’C:’ -Confirm:$false

     2) Create the scheduled task to run powershell and load the exchange snappin; then run your script.  The action of your scheduled task should look like:

    powershell.exe -PSConsoleFile "C:Program FilesMicrosoftExchange ServerBinExShell.psc1" -Command ". ‘C:script.ps1’"

    The examples above should also answer your question on how to avoid confirmation questions (-Confirm:$false).

  26. matthias says:

    Ricardo, you are great ! It’s working fine :-)

    Saludos

    Matthias

  27. amsiketa says:

    Hello, I have SBS 2003 and am having trouble with my exchange db size currently @ 18G and have read a blog on this site about increasing the size by editing the registry…I have followed the instructions with no luck at all….Does anyone have any experience with this situation?  Any help would be great!!!

  28. Ricardo Rosales Guerrero says:

    Betatester,

    Import-Mailbox should treat Outlook generated PST files the same as "Exchange generated" PST files since we’re using the same API internally.

    Could you tell me which version of Outlook did you use to create those PSTs? Also, could you check if logs are created when exporting/importing "Exchange generated" PSTs?

  29. Ricardo Rosales Guerrero says:

    Dan,

    Interesting question; mail imported to a mailbox using import-mailbox will indeed be journaled if the mailbox is part of a journal rule.

    On the other hand, if you have client rules (e.g. Send all email from a person to a specific folder) those won’t be fired against the imported mail.

  30. Ricardo Rosales Guerrero says:

    Briam,

    The permissions required to export/import to a PST are Exchange Organization Admin or Exchange Server Admin on the server where the mailbox lives and must belong to the local computer Administrators group on the machine running the tasks.  

    The user running the tasks does not have to have a mailbox on E2K7.

  31. Briam says:

    Thanks Ricardo.  Exactly what I needed to know.  It pointed me in the right direction and it is working great!.

  32. Betatester says:

    Dear Ricardo.

    I have tested the Import Export functionality of Exchange 2007.

    See my blog:

    http://trycatch.be/blogs/chummy/archive/2007/04/28/ways-to-import-a-pst-in-exchange-2007.aspx

    I have tested this on several Outlook versions, and the first time I import something this never worked for me.

    First I export the mailbox

    Than I do an import of that.

    Otherwise it won’t work.

    I have checked the migration files (logs) but there it states that it was successfully imported.

    Perhaps a bug in this beta?

    Best regards

    Chummy

  33. Briam says:

    Is there a special syntax to get the dumpster on Exporting to PST when using Export-Mailbox -PSTFolderPath?

  34. Betatester says:

    The Outlook 2007 version I used was Outlook (12.0.4518.1014) … part of Office Ultimate. I also used Outlook 2003 with the same results.

    Also perhaps there is a problem with the language detection.

    When the pst is not in english format, the correct language has to be set on the mailbox. Otherwise, there is a mix with english-other languages in your inbox.

    I have done this with set-mailbox Mailbox -languages "nl-Be" which is the language of my pst’s.

    An initialisation mail has also to be send to this mailbox, otherwise the mailbox language stayes in English.

    Perhaps I’m doing something wrong here?

  35. Briam says:

    Two Quick Questions (I hope):

    Does Import-Mailbox with PSTFolderPath extract dumpster (because I cant get it to)?

    When is the estimated release of this BETA as RTM?

  36. Briam says:

    Correction:…I meant Export-Mailbox…

  37. RobNolley says:

    Betatester, thank you for your blog entry on export and import.  It works great!  However, I noticed that it did not import user-created folders.  I can see the folders when attached to Outlook 2007, however they do not import into Exchange 2007.  All default folder import correctly.  Any ideas?

  38. jim says:

    Anyone notice that you can’t apply the latest critical Exchange 2007 patch from MS with SP1?  Any way around this?   The patch is much newer than SP1

  39. Exchange says:

    Jim,

    We do not build versions of rollups that go on top of Beta Service Pack build. So what you are seeing is expected at this point.

    If and when additional Beta releases come – they will have current rollup functionallity integrated into them.

  40. jim says:

    Thanks so much for the info!   I guess my big question is, when the real SP1 comes out will I be able to put it on top of my Exchange 2007 w/ SP1 beta?

    I can’t find any place to discuss the issues with SP1 Beta – where is the best place?   Some issues so far –

    It appears as though OWA password change does not work – The password supplied does not meet the minimum security requirements.

    Please contact technical support for your organization if you need help.

    The password has never been used and exceeds policy requirements – password which doesn’t work in OWA change password can be used otherwise.  

    The console keeps crashing – particularly if I hop between items e.g. user mailboxes.

    Thanks for your time!!!

  41. Exchange says:

    jim,

    When SP1 for E2007 RTMs, it will most likely include all of the rollups up to that point (can’t be sure because of exact timing of events but that’s the idea).

    Once we RTM, the future rollups will go on top of SP1. However we will not be doing work to make rollups go back to SP1 Beta and patch that up. We don’t do packaged fixes for Beta code.

  42. jim says:

    Thanks for getting back to me – so to be clear,

    1  I will be able to apply SP1 to my system even though it already has SP1 beta?

    2  Any place to discuss SP1 beta issues?

  43. Exchange says:

    Jim,

    OK now I understand what you were asking, which I did not understand before :)

    As a general rule, we do not support in-place upgrades from Beta to RTM for Exchange unless you are on the TAP program or the Beta program specifically said that this would be supported. If you are on the TAP program, then we work closely with you to have a supported way of going from Beta to RTM in production.

    Now – the reason why this is is kind of simple – and comes from the fact that there is no support for Beta in production environment in the 1st place unless you are on the TAP program to begin with.

    So I will answer you by asking – you are not installing this in production, right? And if it is a lab, then installing a new org should not be a problem? :)

    Seeing that the Beta of E2007 SP1 at this time is not a open Beta accessible to all, we do not have a place to discuss those issues as of now – that might change in the future though.

  44. jim says:

    Thanks,

    It isn’t in production yet although my client would like to make it production next weekend.  I have been pretty thoroughly testing it.  The full functionality of OWA is a big item for my client so I’m hosed either way.   I guess that is why I was asking if there is any way to uninstall SP1 beta – then I could just install SP1 when it officially comes out.

    I have been using my personal e-mail account on the system for a couple of weeks so it seems fine for end user use but if I can never upgrade it, I don’t want to go that route.

    I guess I don’t really need any more support for it, other than being able to apply the official SP1 when it becomes available.

    If my only choice is to stay on SP1 beta and never be able to upgrade or stick with Exchange 2007 RTM "as is" the best choice might be to just roll out another 2003 server which works better and wait for 2007 SP1 – which seems rather unfortunate and costly for my client.

  45. easy-v says:

    For clarity, you would need the 32-bit version of Exchange 2007 and the 32-bit version of Exchange 2007 SP1, correct?

  46. Exchange says:

    easy-v,

    If you are asking what you need to make this export functionality work then the answer is – you would need Exchange 2007 SP1, yes. the functionality is there in both 32 and 64 bit versions of SP1.

  47. Mick377 says:

    I’ve installed Exchange 2007 SP1 CTP x86 (received on TechNet Beta Eval) on my XP workstation. I’m trying to import some large Office2003 PSTs (eg 15-20GB) back to Exchange so that I can have an email archiving solution import them from mailbox to SQL.

    My problem seems to be that the Shell Import-Mailbox command is having problems coping with 125,000 messages in the Inbox. I have created smaller PSTs and these will import (using the same folder structure and messages from the large PST). There is no errors that I can see with the large PST, but nothing gets imported to the Inbox. I have checked and I do not believe it is a mailbox storage limitation.

    This is the third place I have tried to report this problem, if there is a better place to report problems with the CTP I would be pleased to find a way of getting in touch with the people who can fix the problem.

    Thanks

    Mick

  48. Nate says:

    So if I understand this correctly, I will need to put SP1 (beta) on my 32bit workstation w/ Outlook that I use to administer the server, and not the server itself, and I should run (and accordingly schedule, in my case) export-mailbox from there? Is that correct?

    That sounds much better than having to put Beta software on the server — since this sounds like functionality I desperately need.

  49. Exchange says:

    Nate, that is correct.

  50. Jeff25 says:

    Back to an earlier section of Jim’s question: he mentioned he was getting the error "The password supplied does not meet the minimum security requirements. Please contact technical support for your organization if you need help.". I’m getting this too, with a fresh install of x64 E12 and a fresh domain. I got a test user created and told them to change thier password for the domain via OWA and they got the error above. I’ve verified it myself – I even turned off the domain security policy controlling password complexit, and still it complains. Any tips for that? I’m running the latest rollup patches.

  51. CLuELeSS says:

    Hi, I have the same error message as Briam, the post from 16 april. Im trying to import pst files from our old organisation with exchange 2003. I have extracted the pst file from our old server with exmerge.

    I have installed 2007 managrement tools on a 32-bit client with Win XP Pro. and installed SP1 beta. (as suggested in Nate post)

    The server is Win 2003 server x64 with exchange 2007 but NOT with SP1 beta.

    I have checked the permissions, and i´m in the security groups i should be (Exchange Organization Admin AND Exchange Server Admin ) and I try to import the pst-file:

    import-mailbox -identity test -pstfolderpath c:test

    But i still get the error message:

    Import-Mailbox : Error was found for Administrator (test@test.com) because: Error occurred in the step: Approving object. An unknown error has occurred., error code: -2147221241

    Is the any permissions i have missed?

    In the log file everything seems fine until its time to merge the pst with the new mailbox:

    [provar.per] The operation has started.

    [2007-07-12 13:34:49] [0] [provar.per] Initializing MAPI, loading library.

    [2007-07-12 13:34:49] [0] [provar.per] Approving object.

    [2007-07-12 13:34:49] [0] [provar.per] Logging on to the MAPI profile.

    [2007-07-12 13:34:49] [0] [provar.per] Opening Exchange mailbox.

    [2007-07-12 13:34:49] [0] [ERROR] Error was found for test (test@test.com) because: Error occurred in the step: Approving object. An unknown error has occurred., error code: -2147221241

    Please help! Any ideas?

  52. Andrew2 says:

    I have a need to import my mailboxes into a new Exchange 2007 system in a new building, these will have been exported from our old email system Exchnage 2003.  There is NO communications links between the two sites and never will be.

    If I understand this correctly I need Exchange 2007 SP1 of any type to succesfully import my mail.  How do I get the SP1 patch ?

    Regards

    Andrew

  53. nick says:

    I really wish this command WORKED, but it has bugs.

    Sure, I can run the command, but it only imports SOME stuff, not ALL stuff.  Then it reports that it ran FINE.

    I’ve already had issues with it not importing Deleted Items, Calendars, etc.

    Today it imported 90% of a contacts folder.

    Yep, it just dropped 10%.

    No error message, nothing in the logs.

    If the user had not have told me then we would have never knows.

    What’s the point of a system such as this if it’s going to randomly screw up, with no errors.

    My confidence in this command has dropped to about ZERO.

    If I cannot trust it to do what I NEED it to do, then I will have to do things manually.

  54. nick says:

    The import-mailbox command is also very strange in its implementation of options.

    I can import based on keyword.

    I can import based on attachment.

    I can import based on time-stamp.

    But I cannot tell it to only import non-duplicate items.

    So if I run an import twice, do I end up with duplicates??

    (Who knows, they don’t document it.)

  55. So – no responses here?  Is there no way to import multiple .pst files into one mailbox and prevent message duplication?

    This is a major deficiency, to say the least.

Comments are closed.