Exchange 2013 public folder migration error

When migrating our public folders for the first time (from 2007 – 2013), I hit this error:

Property expression “xxx yyy” isn’t valid. Valid values are…

etc etc. Having found some things online, it seems that this is a fault with the alias having space in it, which isn’t allowed. One site talked about using ADSIEdit which I though was a bit extreme so just used this instead:

Set-MailPublicFolder -Identity “xxx yyy” -Alias “xxxyyy”.

If you get two Exchange PowerShell screens open- one on the legacy system , one on 2013- run

Get-MailPublicFolder | FL “Alias”

on the 2013 box, and use the Set-MailPublicFolder on the legacy box. The 2013 server will flag up all the folders that have this space-in-the-alias-name fault, and then you can just copy and paste the folder names into the legacy server. This seems to have sorted the error out as it’s now performing the migration.