Every Exchange migration I do that involves public folders always has its own little fiddly unique error, one I am working on at the moment is no different.
I was at the stage of running the Export-PublicFolderStatistics command to CSV and I received the following error:
At C:\Scripts\Export-PublicFolderStatistics.ps1:193 char:88
The statistics export will then fail. I downloaded various new scripts and continued to get the same error. After MUCH research and working with my colleague Pete (www.petenetlive.com) I found the issue to be the following.
Exchange 2007 does not like the following variable in the Export-PublicFolderStatistics.PS1 script, “$_.MapiIdentity”.
To resolve the issue edit the file “Export-PublicFolderStatistics.ps1” and find this text in file “$_.MapiIdentity” and replace it with “$_.Identity“.
Save the file and run your script again and you will then be able to run the command successfully. This issue will apply to Exchange 2007 to Exchange 2013 and Exchange 2010 to Exchange 2016