Invoke-Command to Microsoft Exchange

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 :

Microsoft advices to use .AddScript() or .AddCommand(). can someone tell me how to use this commands with invoke-Command ?

Any help is appreciated.


Looks the techcommunity url is broken, can you verify it once.

Yes i see this should work: