Hi Rich,
I have tested this, but is gives an error:
Invoke-Command : Parameter set cannot be resolved using the specified named parameters.
At line:14 char:1
- Invoke-Command -Session $myNodeSession -ConfigurationName $PSSessionC ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
- FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand
I have have found another workaround. I have added the parameter -NoMachineProfile to the New-PSSessionOption cmdlet:
Clear-Host
[string]$FQDN_NodeName = "server.my.domain.nl"
[string]$User = "mydomain\user"
[string]$PSSessionConfigurationName = "SQL-AuditSQLConfig2"
$Password = ConvertTo-SecureString -String "**********" -AsPlainText -Force
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $Password
$sessionOptions = New-PSSessionOption -IncludePortInSPN -NoMachineProfile
$myNodeSession = New-PSSession -ComputerName $FQDN_NodeName -ConfigurationName $PSSessionConfigurationName -Credential $Credential -SessionOption $sessionOptions
Invoke-Command -Session $myNodeSession -ScriptBlock { $ExecutionContext.SessionState.LanguageMode }
Remove-PSSession -Id $myNodeSession.Id
Now it returns the language mode "FullLanguage"
It still doesn't clarify why the session on this particular server switches to "ConstrainedLanguage", while others don't. But I can continue my work.
Regards,
Marco