1- In Windows run PowerShell as an admin
2- Install PowerShell v2 if not installed:
Install-Module -Name ExchangeOnlineManagement
3- Import Exchange Online Management module:
For Windows 11 you might have to allow running scripts because running scripts is disabled by default, run this command to allow running scripts.
4- Connect to Office 365 with admin user:
Connect-ExchangeOnline -UserPrincipalName Admin@WhateverDomain.com
Replace firstname.lastname@example.org above with office 365 administrator account. You will be prompted for credentials and a code if multi-factor authentication is enabled.
5- After that if you want, for instance, to grant a user named User1 “Author” permissions on root of public folders
Get-PublicFolder -Identity “\” -Recurse | Add-PublicFolderClientPermission -User User1 -AccessRights Author
Replace User1 above with the user you want to grant access
6- To view permissions on the public folders called My Public Folder
Get-PublicFolderClientPermission “\My Public Folders”