SBS 2008 – How to Export and Import Mailboxes To and From PST

[Today's post comes to us courtesy of Wayne McIntyre]

As many are already aware, exmerge is no longer supported in Exchange 2007, this has been replaced with the Power Shell cmdlets import-mailbox and export-mailbox introduced in Exchange 2007 SP1 that now handle this functionality.

This post was adapted for SBS from an Exchange team blog post by Ricardo Rosales Guerrero with permission, original Exchange team post can be found here: https://msexchangeteam.com/archive/2007/04/13/437745.aspx

Important:   If you use PSTs to migrate mailboxes from one Exchange server to another instead of using the move-mailbox procedure, you will need to read the following blogpost to correct a certain issue with replying to old email:  https://blogs.technet.com/b/sbs/archive/2009/05/21/cannot-reply-to-old-emails-or-modify-old-calendar-items-after-pst-mail-migration.aspx

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. You can download Exchange 2007 Sp1 32-bit (E2K7SP1EN32.exe) from https://www.microsoft.com/downloads/details.aspx?FamilyID=6be38633-7248-4532-929b-76e9c677e802&displaylang=en *You will also need to install PowerShell before you install the management tools.
  • Either Outlook 2003 SP2 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.
  • The user running the task must also have full mailbox access to the user mailbox you want to export/import.
  • To use the export-mailbox cmdlet, the source mailbox must reside on either Exchange 2007, Exchange 2003 SP2 (or later), or Exchange 2000 SP3 (or later).
  • To use the import-mailbox cmdlet, the target mailbox must reside on an Exchange 2007 mailbox server.
  • You cannot import or export data to or from a mailbox in a Recovery Storage Group
  • You cannot import or export data to or from a public folder.

Granting Full Mailbox Access

To grant the user running the task full mailbox access to all mailboxes the easiest way to do this is by running the below Power Shell Command:

Get-Mailbox | Add-MailboxPermission –user Username –AccessRight FullAccess –Inheritancetype all

Replace username with the Exchange Organization Admin username.

If you only wish to add permission to one specific user, simply run:

Add-MailboxPermission –Identitiy “MailAlias” –User Username –AccessRight FullAccess –InheritanceType all

Alternatively you can also add full mailbox access through the Exchange Management Console.

clip_image002

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.

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 “mailbox database” | 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.

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 “mailbox database” | 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'