While importing (and exporting) mailboxes should be easy these days, if you don't have near monthly experience doing so, there are several gotchas that can getcha. In this article, I try to make your imports just a little more reliable and keep you a little saner!
For people, importing mailboxes into an Exchange may be a routine occurrence. I am not one of those people. So having a step-by-step procedure for something that SHOULD be easy but somehow manages to be just a bit complicated is a good thing. Hopefully, you'll find this helpful.
The default configuration for Microsoft Exchange does not grant even the administrators rights to import or export mailboxes. This is something that they must explicitly grant to themselves, or better still, to a group designated for this purpose.
Create a Universal Security group - I recommend "Exchange Mailbox Import Export" - which will be granted the rights to import and export mailboxes. Add the appropriate user account(s) to the group for the user(s) you desire.
New-ManagementRoleAssignment -SecurityGroup "Exchange Mailbox Import Export" -Role "Mailbox Import Export"
Don't forget to log out of the Exchange server and log back in before the right takes effect. Now you should have the right to import mailboxes. The New-MailboxImportRequest cmdlet has many options. I won't cover them all but will list some of my recommendations below.
For a complete list of options and what they do, reference: New-MailboxImportRequest by Microsoft
You must specify a mailbox by Name or Alias that you want to import the file to, and of course, a file to import. If you're not sure what the mailbox names are, you can use Get-Mailbox to list current mailboxes in the system (when you're importing mailboxes, the PST file you're importing must be imported into an existing mailbox)
New-MailboxImportRequest -Mailbox username -FilePath "\\Server\Share\Path\To\ImportFile.pst" ...
Tip: in my most recent attempt to import mailboxes, I first tried cross-domain with no trust, but the Exchange process that tried to import the messages failed, presumably because it didn't have access rights. So as a workaround, I mounted the VHD I had created to store the email as an attached VHD in Disk Management rather than connect it directly to the VM. I had several reasons for this given the network and users I was importing and to be safe, I would recommend doing the same.
But wait, there's more! Sometimes PST files can have "bad" messages or other items. There are three parameters you can and probably should set to ensure everything that can be imported is imported:
... -AcceptLargeDataLoss -LargeItemLimit Unlimited -BadItemLimit Unlimited ...
AcceptLargeDataLoss is essentially a switch that you are enabling by specifying it. If you specify a value larger than 50 for either LargeItemLimit or BadItemLimit, you must specify AcceptLargeDataLoss.
LargeItemLimit can be any valid integer or Unlimited. A large item is defined as any item that is larger than the maximum size of a message the mailbox can normally accept. If this is not specifically defined for the user, then an organization-wide value is used.
BadItemLimit can be any valid integer or Unlimited. A bad item can be corrupt or missing items from the source mailbox. The default value is 0. As soon as the bad item limit count is reached, the request will fail. However, you might want to know if there are "too many" bad items. Only you can determine the appropriate number for you.
... -CompletedRequestAgeLimit 7 ...
CompletedRequestAgeLimit defaults to 30 days. After the request has been completed, this is how long the request will remain retrievable in the system.
... -ConflictResolutionOption KeepLatestItem ...
ConflictResolutionOption determines how the import request will handle items that already exist. Valid options are ForceCopy, KeepAll, KeepLatestItem, KeepSourceItem (default), KeepTargetItem, UpdateFromSource.
... -Name JoeUserImport1 -Priority High
Though Name is optional (Exchange will generate up to 10 request names per mailbox), I prefer naming each request so I easily know what I'm looking at.
The Priority is optional and if none are specified, all will share the same priority. However, there can be circumstances (for example, C-level executives vs salespeople and human resources employees) who might need/want to get a higher priority. There are only two options - Normal and High.
Now if we combine all the options:
New-MailboxImportRequest -Mailbox username -FilePath "\\Server\Share\Path\To\ImportFile.pst" -AcceptLargeDataLoss -LargeItemLimit Unlimited -BadItemLimit Unlimited -CompletedRequestAgeLimit 7 -ConflictResolutionOption KeepLatestItem -Name JoeUserImport1 -Priority High