To revoke permissions for GrantSendOnBehalfTo from a mailbox, it is pretty well documented, that you would do this:
Set-Mailbox -Identity MyMailbox -GrantSendOnBehalfTo $null
That works when run from powershell and in a local script.
However, if I include it in a script, that runs remote powershell (using New-PSSession etc), it fails with this error:
Couldn't find object "[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]". Please make sure that it was spelled correctly or specify a different object. + CategoryInfo : NotSpecified: (:) [], ManagementObjectNotFoundException + FullyQualifiedErrorId : A32A9BAB
So it will not accept $null as a parameter.
How can I get around that?