Hi,
Make sure your account has enough permission to run
Search-Mailbox cmdlet.
Add-RoleGroupMember "Discovery Management" -Menber Youraccount
If you want to delete messages from UserA with -deletecontent switch, your account needs also to be in Mailbox Import Export role.
First you need to create a new role group:
New-RoleGroup Mailbox Import-Export Management -Roles Mailbox Import Export
Then add your account to the group:
Add-RoleGroupMember Mailbox Import-Export Management -Member Youraccount
And try this command to move messages
Search-Mailbox -Identity UserA -TargetMailbox UserB -TargetFolder move -LogLevel full
-DeleteContent
If you dont want to delete messages from UserA, then remove -DeleteContent switch from this command.
Note: The Search-Mailbox cmdlet will return up to 10000 results per mailbox. To return more than 10000 results, use the New-MailboxSearch cmdlet or the In-Place Discovery & Hold console in the Exchange Admin Center.
Best Regards.