Author Posts

May 12, 2017 at 6:21 pm

I am setting up remote capability within our 100+ Terminal Server enviornment and I have run into a snag when trying to use the Invoke-command cmdlet to run scripts on these servers.

What I am seeing is that within our terminal server environment, Language Mode has by default set to ContrainedLanguage Mode which is preventing me from launching an application inventory script to get a list of installed applications on our terminal server farm.

I was wondering if anyone can direct me to 'best practices' with enabling 'Full Language' mode on a production network. I need to make the argument to my boss if I am going to open this up on our network.

C:\Users\bclanton\Code\terminalServers> Invoke-Command -ComputerName w2k8-r12-01 -FilePath {.\InstalledPrograms.ps1} -Credential XXXXX\administrator
Cannot invoke method. Method invocation is supported only on core types in this language mode.
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage
    + PSComputerName        : w2k8-r12-01
 
You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : w2k8-r12-01
 
You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : w2k8-r12-01

Target Server w2k8-r12-01

PS C:\Users\tsadmin> $ExecutionContext.SessionState.LanguageMode
ConstrainedLanguage

May 14, 2017 at 8:50 pm

After reviewing 'Advanced Remoting Configuration' I feel that maybe my answer is to create a custom configuration file that will give select 'administrators' rights to run scripts with the appropriate Language Mode so when I run my inventory script and future scripts, I can do so unimpeded.

Researching further.