How to Import and Export Mailboxes using PST Files in SBS 2011 Standard

How to Import and Export Mailboxes using PST Files in SBS 2011 Standard

  • Comments 5
  • Likes

[Today’s post comes to us courtesy of Gagan Mehra and Wayne Gordon McIntyre from Commercial Technical Support]

There might be instances where an Exchange Administrator will need to export the contents of individual mailboxes to offline files (PST). With Exchange 2010 SP1 we have new set of PowerShell commandlets to export and import mailboxes to and from PST files. Exchange 2010 SP1 makes this much simpler by having its own PST reader and writer. If you recall from SBS 2008 there were a large number of requirements needed to be able to export/import PSTs. You can view the process of exporting/importing PSTS on SBS 2008 from the following blog post.

http://blogs.technet.com/b/sbs/archive/2009/01/13/sbs-2008-how-to-export-and-import-mailboxes-to-and-from-pst.aspx

Important:  If you use PSTs to migrate mailboxes from one Exchange server to another instead of using a mailbox move request, you will need to read the following blogpost to correct a certain issue with replying to old email:  http://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 Requirements

By default, no user is allowed to Import/Export the mailboxes from Exchange PowerShell. In order to view or run Import/Export Cmdlets in Exchange PowerShell, you need to be given explicit permission.

In order to provide a user with permission to Import and Export, you need to run the following command from Exchange Management Shell. You can also assign this permission to a group if necessary using the -Group option:

New-ManagementRoleAssignment –Role “mailbox import export” –User “Admin”

clip_image002

Once the above command is run, close and reopen the Exchange Shell as administrator.  The Import and Export Cmdlets will now be available to the Admin user. You can now Export and Import mailboxes from Exchange Management Shell using the new MailboxExportRequest and MailboxImportRequest cmdlets.

Exporting Data from an Exchange 2010 SP1 Mailbox to PST File

With Exchange 2010 SP1, exporting a mailbox will be done by using “New-MailboxExportRequest” Cmdlet.

In order to Export the entire mailbox content to a PST file we need to run the following command:

New-MailboxExportRequest –Mailbox user –FilePath “\\<servername>\Sharename\user.pst”

Note that the -Mailbox and -FilePath parameters are the only required parameters of the cmdlet. Additionally the -FilePath parameter only accepts a UNC path (\\servername\share).

clip_image004

The “New-MailboxExportRequest” will trigger the export of the mailbox to a PST file and queue the request. In order to confirm the status of the mailbox export request we can run:

Get-MailboxExportRequest

clip_image006

In this case the mailbox export has completed successfully. If you wish to remove the completed mailbox export requests from the queue you can run:

Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest

Exchange 2010 SP1 also provides you the granularity of Exporting particular data from a Mailbox by using the –IncludeFolders parameter. For Example, if you want to export only the Inbox of a mailbox then you can use –IncludeFolders parameter specifying the inbox folder..

For exporting only the inbox of a mailbox you have to use following command:

New-MailboxExportRequest –Mailbox “user” –FilePath “\\<servername\sharename\user.pst> -IncludeFolders “#Inbox#”

For exporting the messages that contain the words “company” and “profit” on the body of the message for user admin received before January 1, 2011 use the following command:

New-mailboxexportRequest –Mailbox Admin –ContentFilter {(body –like “*company*”) –and {body –like “*profit*”) –and (Received –lt “01/01/2011”)} –FilePath “\\<Servername>\PSTFileShare\Admin_CompanyProfits.pst”

These and many other examples of using this cmdlet can be found on the following Technet page or by using Get-Help New-MailboxExportRequest -Full

http://technet.microsoft.com/en-us/library/ff607299.aspx

Bulk Export of Mailboxes

In a lot of cases you will probably want to export all the mailboxes at once to PST. In order to do this you can run the following command to export all mailboxes to a pre-created share named "PST":

$Export = get-mailbox; $Export|%{$_|New-MailboxExportRequest -FilePath \\localhost\PST\$($_.alias).pst}

clip_image008

Importing Data from a PST File to Mailbox

Importing a PST file to a mailbox is very similar to the way you export mailbox to a PST file. You need to use the following command

New-MailboxImportRequest –Mailbox Admin –FilePath \\<Servername>\PSTFileShare\Admin.pst 

 

clip_image010

Note: if you already have some data in the mailbox to which you are importing then the above command will merge the data with it.

To see the whether the Import has been completed you need to run the following command

Get-MailboxImportRequest

clip_image012

If you want to Import the PST file into a specified folder under the mailbox then we can use the following command with a –TargetRootFolder parameter which will create a specific folder and import all the data into it.

New-MailboxImportRequest –Mailbox Admin –FilePath “\\<server name>\PSTFileShare\admin.pst” -TargetRootFolder “RecoveredFiles”

Bulk Import of Mailboxes

Bulk Import also works very similar to the bulk Export. To import all of the PST files into their respective mailboxes run the following command:

$Import = get-mailbox; $Import|%{$_|New-MailboxImportRequest -FilePath "\\localhost\PST\$($_.alias).pst"}

clip_image014

*note: this also assumes that you originally exported the mailboxes using their alias as the pst file name.

Note: By Default, the import checks for the duplication of items and does not copy the data from the .pst file into the mailbox of matching items exists in the target mailbox.


Import and Export Request Statistics

With large mailboxes, the import and export requests may take a while to complete. If you need to view the status of an import or export request you can use the following commands (Test is the mailbox alias):

Get-MailboxExportRequestStatistics -Identity Test\MailboxExport

Or

Get-MailboxImportRequest -Identity Test\MailboxImport

More examples and detailed information can be found on the technet links below:

http://technet.microsoft.com/en-us/library/ff607427.aspx

http://technet.microsoft.com/en-us/library/ff607297.aspx

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
Comments
  • Really a very fantastic approach !
    In my work-station, due to not much familiar with PS usage, I use this automated application(http://www.exchangemailboxtopst.org/) to export/import mailbox items into PST format. This tool make my job much easier that provide the option to export or import only required mailbox items by selecting them as per need.