Public Folder Migration to Exchange Online (500k Folders) Part 11 — Post-Migration Issues (Add/Remove Permissions)

I thought I’d post this to help those who are struggling with Microsoft throttling and endless re-authentication prompts when trying to add/remove Public Folder permissions after you’ve migrated to Exchange Online Public Folders.

I’ve raised this with Microsoft, and while they have reduced their throttling limits for us, trying to assign permissions to vast number of folders always fails. Now… while Microsoft do provide a new script designed for Exchange 2013 and Exchange Online, found here, we certainly found we still got timeout issues and (in our case hierarchy issues where Mailbox1 kept going offline).

This is just one of the issues we were getting when trying to add a large number of permissions. This is all down to throttling, simply leave it and it’ll come back.

An example of throttling when trying to Add/Remove Public Folder permissions
An example of throttling when trying to Add/Remove Public Folder permissions

Now, getting the above error when you run the script is never going to go down well. Basically it’s broken and you have to start again, this is extremely frustrating…

So, I wrote the below script. It’s partly taken from Microsoft’s own, however I’ve amended it so it checks the PowerShell session to see if it becomes broken if it does it’ll drop and reconnect it.

It also checks against the known errors that I’ve come across. If detected, it’ll pause the script for a set time before dropping and reconnect to ExO.

From having regular timeouts or issues, I’ve now been able to run this script for days (until my machine runs out of memory).

An example of the script above…