Pages

Tuesday, February 25, 2014

Importing PSTs into Microsoft Exchange Server 2013 with PowerShell

I had to import a bunch of exported PSTs into a new Microsoft Exchange Server 2013 environment as we had to migrate a new client from another hosting provider onto our platform and as I haven’t done it for awhile, I didn’t realize how many errors I ran into in the past so I figure I’d write a blog post that I can refer to in the future.

The PowerShell cmdlet used for importing mailboxes is New-MailboxImportRequest which can be found at the following TechNet article:

New-MailboxImportRequest
http://technet.microsoft.com/en-us/library/ff607310(v=exchg.150).aspx

Prior to begin importing PSTs, you will need to assign a user with permissions to perform the action as described in the following TechNet article:

Recipients Permissions
http://technet.microsoft.com/en-us/library/dd638132(v=exchg.150).aspx

To grant the permission, use the following cmdlet to add a user to the Mailbox Import Export role:

New-ManagementRoleAssignment -Role "Mailbox Import Export" -User Administrator

**Note that I’ve assigned the Administrator account the role in the cmdlet shown above.

image

With the permissions set, the cmdlet used to import a PST into a mailbox of a user creating a folder named “Migrated Emails” would look like following:

New-MailboxImportRequest -Mailbox "John Smith" -FilePath \\someFileServer\E$\someFolder\john_smith.pst -TargetRootFolder "Migrated Emails"

Once the cmdlet above has been executed, you can use the Get-MailboxImportRequest cmdlet to view the status:

image

Once the PST import has successfully completed, you should see an output similar to the following:

image

To clear the completed mailbox imports, you can use the following cmdlet:

Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest

image

There will be times when you’ll notice that various imports mail fail and to investigate why the move has failed, you can use the following cmdlet to include a report:

Get-MailboxImportRequest -Status Failed | Get-MailboxImportRequestStatistics -IncludeReport | Format-List > AllImportReports.txt

image

What I’ve found in the past is that the 2 reasons why imports would fail are:

  1. Bad Items
  2. Large Items that exceed the mailbox stores’ limits

To get around the bad items, you can set a limit of bad items you are willing to skip as such:

New-MailboxImportRequest -Mailbox "Maria Smit" -FilePath \\someServer\E$\someFolder\maria.pst -TargetRootFolder "Migrated Emails" -BadItemLimit 10

Note that if you specify a bad item limit of higher than 50, you will also need to use the switch to avoid having the cmdlet fail:

-AcceptLargeDataLoss

To get around the large items, you can use the following switch to ignore the size of the large item limit and to import them anyways:

New-MailboxImportRequest -Mailbox "Maria Smit" -FilePath \\someServer\E$\someFolder\maria.pst -TargetRootFolder "Migrated Emails" -LargeItemLimit 10

3 comments:

James said...

Hi,

If you read http://technet.microsoft.com/en-us/library/ff607310(v=exchg.150).aspx, you'll see that the import will skip the large items and NOT import them, and mark the import as successful.

If you set a number using LargeItemsLimit, it will skip this many items before designating the import a fail.

I thought the same as you, i.e. that it will import them anyway, but it actually skips them.

Unknown said...

Hi.

I trying to import a PST File to one mailbox I follow the step but can you help with tis step to interpreter.

[PS] C:\Windows\system32>New-MailboxImportRequest -Mailbox "lzambrana" -FilePath \\SDWV-XCH01-DS\E$\Migrated_PST\LuizZambrana.pst -TargetRootFolder "Migrated_PST"
Unable to open PST file '\\SDWV-XCH01-DS\E$\Migrated_PST\LuizZambrana.pst'. Error details: Could not find file
'\\SDWV-XCH01-DS\E$\Migrated_PST\LuizZambrana.pst'.
+ CategoryInfo : NotSpecified: (:) [New-MailboxImportRequest], RemotePermanentException
+ FullyQualifiedErrorId : [Server=SDWV-MBX01-DS,RequestId=b89d593e-b082-41ee-a254-62e30bcd348a,TimeStamp=3/10/2016
11:03:53 PM] [FailureCategory=Cmdlet-RemotePermanentException] 660EA64F,Microsoft.Exchange.Management.RecipientTa
sks.NewMailboxImportRequest
+ PSComputerName : sdwv-mbx01-ds.mydomain

[PS] C:\Windows\system32>

Regards.

askericksmith said...
This comment has been removed by the author.