Hi All,
a recent patch of Microsoft Exchange changed the way people can use Invoke-Command to an Microsoft Exchange server.
Invoke-Command -Session $ExOSessionVariable -ScriptBlock {Get-RemoteMailbox -Identity UserName ; Get-User -Identity UserName}
is returning:
The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode.
This behavior has changed since : https://techcommunity.microsoft.com/t5/exchange-team-blog/released-april-2021-exchange-server-security-updates
Microsoft advices to use .AddScript() or .AddCommand(). can someone tell me how to use this commands with invoke-Command ?
Any help is appreciated.
Michael