writeErrorStream : True
Exception : System.Management.Automation.RemoteException: The term ‘New-Object’ is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the spelling of the nam
e, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.PowerShell.CoreInvokeRemoteHelper[TInput,TOutput](PSDataC
ollection1 input, PSDataCollection1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataC
ollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.RemotePipeline.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline,
The session is constrained and I don’t think it has new-object available. Rather than entering the session - use import-possession to make proxy functions of the Exchange cmdlets and work with them that way
The Exchange team designed their PowerShell implementation to be deliberately constrained when accessed remotely. As I stated earlier the best way is to create the session and then use import-pssession.
That is the way it is designed to work and that is the way that works best. I have spent a lot of time accessing Exchange remotely and think I’ve tried most options. Importing the session is the cleanest way to work