Whether you are trying to make a backup for a departing employee, to respond to a discovery motion or a compliance request, or you are trying to import data into a test environment, you may from time to time need to either import data from a PST into a mailbox or export a mailbox to a PST. Here is how you can use the Exchange Management Shell to import a PST into a mailbox or export a mailbox to a PST quickly and efficiently.
[ulp id=”fW6YluQmBuSe8SV2″]

Prerequisites: user rights

Whether you want to perform an import or an export, you need specific rights. If this is the first time you have attempted to import or export a mailbox, you must assign yourself the “Mailbox Import Export management” RBAC role. Here is how you can do this easily, with scale for the next guy.

  1. Launch Active Directory Users and Computers, and create a new security group called “Mailbox Import-Export”
  2. Add your user account, and any others who need to perform this task, to the group
  3. Launch the Exchange Management Shell
  4. Run the following command, changing the name of the Security Group as appropriate. New-ManagementRoleAssignment -Name “MailboxImportExport” -SecurityGroup “Mailbox Import-Export” -Role “Mailbox Import Export”

If you get an error, check your spelling for the role and the security group

  1. Now, log off and then back on so your new group membership is associated with your account so you have the rights to perform imports and exports.

Prerequisites: user rights

To perform exports and imports, Exchange must access a directory through a UNC path. It can be a share on the Exchange server, but commands must reference a UNC path (and not a local drive letter). Set up a share for your data as follows:

  1. Create a network share to store newly-created PSTs from exports or to access PSTs for imports
  2. Grant read/write permission to the group “Exchange Trusted Subsystem” to this share.

Importing a mailbox from PST

Here is how you can import data from a PST file into a mailbox. Substitute your relevant values for anything in italics.

Import a .PST file into a user’s primary mailbox

This example imports a .PST file into John Smith’s primary mailbox. Data in the .PST file’s Inbox is imported into the RecoveredFiles folder. New-MailboxImportRequest -Mailbox jsmith -FilePath \\fileserver\pst\jsmith.pst -TargetRootFolder “RecoveredFiles” -IncludeFolders “#Inbox#”

Import a .PST file into a user’s archive mailbox

This example imports a .PST file into Dan Brown’s archive folder. Content is merged into existing folders, and folders are created if they don’t already exist in the target folder structure. New-MailboxImportRequest -Mailbox dbrown -IsArchive -FilePath \\fileserver\pst\jsmith.pst\archive.pst

Import multiple .PST files

This will import all the .PST files in the shared folder. If each .PST is named using a corresponding user’s alias, then this example command will create an import request and import the data into the matching mailbox. Dir \\fileserver\pst\*.pst | %{ New-MailboxImportRequest -Name RecoveredPST -BatchName Recovered -Mailbox $_.BaseName -FilePath $_.FullName -TargetRootFolder SubFolderInPrimary} For more information, see New-MailboxImportRequest.

Exporting a mailbox

Exporting a mailbox to PST is similar to importing. You must create any directories in your desired output path before you export or the process will fail.

Export a user’s primary mailbox to a .PST file

This example exports Bob Jones’ primary mailbox to .PST. New-MailboxExportRequest -Mailbox AylaKol -FilePath \\fileserver\pst\bjones.pst

Export a user’s personal archive to a .PST file

This example exports Bob Jones’ archive to a .PST. New-MailboxExportRequest -Mailbox Kweku -IsArchive -FilePath \\fileserver\pst\bjones.pst”

Export selected data from a user’s mailbox to a .PST file

This example exports Bob Jones’ messages that were received before January 1, 2014, and contain the words “vacation” and “holiday” in the message body. New-MailboxExportRequest -Mailbox bjones -ContentFilter {(body -like “*vaction*”) -and (body -like “*holiday*”) -and (Received -lt “01/01/2014”)} -FilePath \\fileserver\pst\bjones.pst

For more information, see http://technet.microsoft.com/en-us/library/ff607299(v=exchg.141).aspx.

Remember, PSTs are not supported for storing enterprise data. The only reason to export a mailbox to PST is to create an archival copy before deleting the mailbox, or to provide a usable form in response to a discovery or compliance request. Importing data from PSTs into primary or archive mailboxes is a great way to get that critical data off the local hard drive of your users, and into an Exchange mailbox where it belongs.

Ideally, you would try and avoid the use of PSTs and directly archive your email from Exchange. A dedicated email archiving gives you additional benefits (great security, no PSTs, central management) and you have greater control over how your email is handled. Central archiving takes away the hassles (and dangers) of PSTs and provides almost unlimited storage for users (who don’t have to worry if they deleted emails from their inbox). If you’re still using PSTs, it may be worth looking into the alternative.

Get your free 30-day GFI LanGuard trial

Get immediate results. Identify where you’re vulnerable with your first scan on your first day of a 30-day trial. Take the necessary steps to fix all issues.