Apr 19 2021 01:59 PM - edited Apr 19 2021 02:00 PM
Invoke-Command -Session $SessionVariable -ScriptBlock {Get-RemoteMailbox -Identity UserName ; Get-User -Identity UserName}
The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode.
If I split-up the single command into two separate statements...:
Invoke-Command -Session $SessionVariable -ScriptBlock {Get-RemoteMailbox -Identity UserName}
Invoke-Command -Session $SessionVariable -ScriptBlock {Get-User -Identity UserName}
...it completes successfully.
Apr 21 2021 11:08 PM
Apr 22 2021 09:01 AM
Take a look at "Known Issues" section in https://techcommunity.microsoft.com/t5/exchange-team-blog/released-april-2021-exchange-server-securi....
"After application of the Exchange Server April security update CMDlets executed against the Exchange Management Console using an invoked runspace might fail with the following error message:
The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode.
This behavior is expected; please change any code using .AddScript() to use .AddCommand() for continued compatibility."
I'm just an amateur Powershell scripter, so I have no idea how to use .AddScript() and .AddCommand()