A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Hi Rising Flight,
Welcome to Microsoft Q&A Forum!
Have a good day and I hope you're doing well!
I completely understand the challenge you are facing. Handling permissions for nested folders containing special characters (like #, &, [], or extended characters) is a notorious pain point in Exchange PowerShell, as standard path parsing often fails.
I replicated your exact scenario in my own tenant to validate your script.
- I created a MY - Projects structure in a test mailbox.
- I created subfolders with names specifically designed to break scripts, including characters like
#,&,[],+, and= - I assigned the initial
PublishingAuthorrights to a delegate user. - I ran your script to upgrade the permissions to
PublishingEditor.
Your script logic is solid. Specifically, the way you reconstruct the Identity property (replacing forward slashes with backslashes and correctly appending the mailbox root) successfully bypasses the path parsing errors usually caused by special characters.
As you can see in the screenshot below from my environment, the script successfully located all "difficult" folders and updated the permissions to PublishingEditor without error:
The script is safe to run. The Try/Catch block correctly handles the logic: it updates existing permissions if found, and adds them if missing, ensuring full coverage even for those tricky folder names.
I hope this provides you with some helpful insights as you proceed with the execution. If you have any further questions or concerns, or if I have misunderstood anything or was unclear, please feel free to reach out at any time.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.