$ScriptInfo = @" 
Migrate-MailboxPermissions | v2.6 
by Roman Zarka 
Description: Mailbox permissions are typically translated to Office 365 during properly batched hybrid MRS moves, however there are several scenarios (e.g. third-party migration tools) where permissions must be audited on-premises and re-applied after migration.

Download package includes source code and documentation.
Export-MailboxPermissions.ps1 should be run from on-premises Exchange Management Shell (EMS) and will audit/export mailbox access, send as, send on behalf, and folder delegate permissions into separate CSV datasets.  Enumerating folder delegates can take considerable time, so auditing only common folders (Inbox, Calendar) is enabled by default. Permissions in O365 can only be assigned using mail-enabled accounts, so script offers options for expanding group memberships and setting explicit user rights.
Import-MailboxPermissions.ps1 should be run from O365 remote PowerShell after mailboxes have been provisioned and will re-apply permissions according to collected on-premises datasets.