Recently I had to import a handful of PST files into a our Exchange 2010 server using the New-MailboxImportRequest cmdlet, and did so without setting the -baditemlimit parameter. During the import one of the files threw an error. Despite the discoverability of PowerShell, I couldn’t quickly figure out how to restart the import with a newly specified bad item limit. Obviously I didn’t want restart the import from beginning with a bad item limit specified, since that would create duplicate items at the destination mailbox. And the Resume-MailboxImportRequest cmdlet did not allow you to change the settings of a failed import. After some searching I came across a TechNet article showing how to do so, but since the information was hard to find via a Google/Bing search I’d figure I’d summarize it.
Once you have a failed mailbox import (the same holds true for exports) you can change the original request by piping it from Get-MailboximportRequest. For example, to set a bad Item limit to 50 on all failed requests.
Get-MailboxImportRequest -Status Failed | Set-MailboxImportRequest -BadItemLimit 50
To hit a specific request you can refer to it by name. By default, import requests are named <alias>\MailboxImportX (where X = 0–9). You could have specified a name for the import beforehand and use that to reference the failed mailbox in question, but I didn’t and this was the only failed mailbox. But if needed to I could have used :
Get-MailboxImportRequest -Identity USERALIAS\MailboxImportX | Set-MailboxImportRequest -BadItemLimit 50
If you can’t find the Identity you could always pipe all the failed requests into a formatted table and filter for Identity and Name property to make it easier to find the failed import in question:
Get-MailboxImportRequest -Status Failed | FT name,identity
Paul Cunningham has an interesting technique to get the Import identity over at his excellent Exchange blog : ExchangeserverPro.com . Basically you pull the user name using the get-user cmdlet, saving it as a variable, and then passing it to Get-MailboxExportRequest’s -identity parameter but with the .dn suffix. For example:
$User = get-user Jdoe Get-MailboxExportRequest -identity $User.dn
So back to the rectifying the failed import: now that you have changed the request and set a larger bad item limit you can then resume all failed requests by:
Get-MailboxImportRequest -Status Failed | Resume-MailboxImportRequest
Or a particular failed mailbox import by:
Get-MailboxImportRequest -Identity USERALIAS\MailboxImportX | Resume-MailboxImportRequest
So what if you wanted to know what issue was causing the failure? You can do so by using the Get-MailboxImportRequestStatistics with the -IncludeReport parameter . You’ll want to output the report to a text file since it will contain a lot of info that will be much easier to search in a text file as opposed to the console screen. Building off my previous example the command would be:
Get-MailboxImportRequest -Identity USERALIAS\MailboxImportX | Get-MailboxImportRequestStatistics -IncludeReport | FL > C:\FILEPATH\report.txt
You can review the exported text file for exact email(s) that caused the import to fail.