One of the new cmdlets introduced in Exchange 2010 SP1 is New-MailboxImportRequest. This gives you the ability to import a PST file without having to have the Outlook client. One of the things I really like about this is the ability to import a PST file directly into the Archive mailbox in Exchange 2010 or Exchange Online. For a full review of this cmdlet and the other related cmdlets, I recommend Henrik Walther’s blog series.
Prerequisites
But before you can start using this new cmdlet, you need to first:
- Give yourself access to the new “Import Export Mailbox Admins” RBAC security role group
- Make sure the Exchange Trusted Subsystem has access to where the PST file is located
- The account you use must have full mailbox permissions to write to the target location of where you are importing the PST file into
- Make sure there are no spaces in the file path containing the PST file, for example, here is a valid path:
New-MailboxImportRequest -Mailbox jsmith -IsArchive -Filepath '\\server\psts\small.pst'
And here is a bad path – it will not like the spaces in the pst file name:
New-MailboxImportRequest -Mailbox jsmith -IsArchive -Filepath '\\server\psts\my life history of emails.pst'
Failure to meet these prerequisites will result in a generic error 'couldn't connect to target mailbox'
Checking Status
So after you kick off one of these imports, how do you check status to see when it completes?
Get-MailboxImportRequest | Get-MailboxImportRequestStatistics -IncludeReport | fl
Idiosyncrasies
While you can queue up multiple PST imports, they will stay queued up and stall if any of the prior ones fail! To remediate, you have to remove the failed request before the queued ones will proceed:
Get-MailboxImportRequest -status failed | Remove-MailboxImportRequest
If you have Database Availability Groups, then importing a large PST file could fail if the database copies fall too far behind. This error will appear when you get the mailbox import request results:
Move for mailbox '/o=ExchangeOrg/ou=corp/cn=Recipients/cn=jsmith:c1818f2c-392a-4d74-916a-17c07fe3987a' is stalled because DataMoveReplicationConstraint is not satisfied for the database 'Mailboxes A-E' (agent MailboxDatabaseReplication). Failure Reason: Database fc72537d-9288-4da3-81a6-a7788e759955 does not satisfy constraint SecondCopy. Some database copies are behind. Will wait until [(15 minutes) to try again]