Creation of Public Folder Migration Batch creation fails because of DisplayName

When migrating Public Folders from Exchange 2010 to 2016 I had a strange error when creating the Migraiton Batch.

So far I had created the Public Folder Mailboxes and the Folder Mapping File using the Scripts from Microsoft. We created 10 Public Foder Mailboxes pfmbx000 – pfmbx009. PFMBX000 is supposed to hold only the hierachy and no content. The folder mapping file was adjusted accordingly.

So when creating the batch I got this error message:

Error at row 1: ‘\’,’PFMBX000′. The root folder must be mapped to the primary hierarchy mailbox: Public Folder Mailbox

I triple checked the name of the mailbox, but everything was correct. When looking again and again I saw that the Display Name of mailbox pfmbx000 is actually “Public Folder Mailbox” – the Name mentioned in the error message.

In the envrironement where this happened all user accounts are created and managed by an Identity Management Solution, so the accounts where created in advance (by someone else) and I did just an enable-mailbox. In my Request to create the accounts, I described them as “Public Folder Mailboxes” -so that Name was used as the displayName. So it turns out that the new-MigrationBatch somehow uses the DisplayName instead of SamAccountName or other consistent attribute. So changing the displayName to the SamAccountname of the PublicFolder Mailbox fixed the error.