I am currently working on a case for a customer where mailboxes were migrated using PST’s from one service provider to another.
After importing the PST’s to the new mailboxes using Import-Mailbox, users started complaining that they were missing items in their mailboxes.
After investigating I found that duplicate items are removed “by default” using Import-Mailbox. You need to manually set the -AllowDuplicates switch in order to skip duplicate item detection. In fact this is the case for every item level manipulating command (Export-Mailbox, Import-Mailbox, Restore-Mailbox, Move-Mailbox).
Unfortunately in my case the missing items were discovered too late in order to start from scratch and import the PST’s with the AllowDuplicates switch set.
Using Exchange Management Shell, you have the option to set the switch, but when moving mailboxes using Exchange Management Console you are left with the default setting, which will remove duplicates without your notice.
The duplicate item check is performed against the PR_SEARCH_KEY, which is unique until the item is copied. Once the item is copied to e.g. another folder, the PR_SEARCH_KEY will exist twice in the mailbox, thus you end up having duplicate items. When importing, moving, exporting or restoring without the AllowDuplicates switch set, only the newest item is kept according to the description I have received from Microsoft.
The -AllowDuplicates switch was implemented in SP1 RU5.
This comment applies for this change, how it worked before and how it works with the new switch.Previously the merge into the destination folder worked like this:
We check if the hash (PR_SEARCH_KEY) of the first item’s to be copied is in the destination folder’s hash table.
If it’s not there then it will be copied.If it’s there then we check the last modification time. If the modification time of the destination is newer then we skip the item.
When “allow duplicate” is set then we simply skip the duplicate detection.
In my opinion –AllowDuplicates should be set by default, giving you the choice to remove duplicates instead.
Hopefully this article will save some of you for extra work developing scripts to fix the problem once the mailboxes are imported and in production as they were in my case.
~Christian