When you want to migrate your legacy public folders from Exchange 2010 to modern public folders in Exchange Online you must prepare the public folder names for migration.
Public folder names are not allowd to contain the following:
The script Fix-PublicFolderNames.ps1 fixes the public folder names in preparation for migration to modern public folders.
# Rename and trim public folders found on Server MYPFSERVER
.\Fix-PublicFolderNames -PublicFolderServer MYPFSERVER