I have a server that is running in Constrained Language Mode which is enforced via GPO. I have a script which I have signed and will run if I run on the server.
PS C:\Utility> hostname
PS C:\Utility> $ExecutionContext.SessionState.LanguageMode
PS C:\Utility> .\TestScript.ps1
I am trying to run this same script from a remote server from which I have domain admin credentials to authenticate with. The error comes back that it is in the Constrained Language mode.
Is there a way to accomplish the execution of this signed script in this fashion? Want to run a similar script on multiple servers.
PS H:\Scripts> Invoke-Command -ComputerName w19-sanfe02 -FilePath .\TestScript.ps1 -Credential XXXX\brian.clanton
Cannot invoke method. Method invocation is supported only on core types in this language mode.
+ CategoryInfo : InvalidOperation: ( , RuntimeException
+ FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage
+ PSComputerName : w19-sanfe02