The error is assumed to be related to permission either to the flying station or to the powershell file.
The error you get comes from the SP cmdlet, so you have successfully opened the bat file and successfully executed the powershell script command. Which then throws an error. UserB does not have the appropriate rights to the farm. Hence the error:
... and that you have the appropriate permissions to access before retrying.
Compare permissions from UserA and UserB in the farm and database.
Or you can use a sledgehammer and log in to UserA to run the following powershell script:
$db = Get-SPDatabase | Where {$_.Name -eq "SharePoint_ConfigDB"} Add-SPShellAdmin "domain\UserB" -database $db
Marco
source share