When preparing to migrate mailboxes to exchange online the account used for the migration will need full access to all mailboxes. It is advised to create a an account just for this purpose, I tend to create a domain account with the username “365-<RANDOM>”.
Replacing <RANDOM> with a random string of characters.
The below command will give the user full access to all mailboxes:
get-mailbox | Add-MailboxPermission -User '<DOMAIN\USER>' -AccessRights 'FullAccess'
Replace <DOMAIN> with the local domain name and <USER> with the required username or group.
Upon successful completion your <USER> will have full access to all mailboxes in your organisation .