On connect.microsoft.com as of last week:
The only item with RestrictedLanguage is https://connect.microsoft.com/PowerShell/feedback/details/770124/constrainedlanguage-mode-is-not-documented-in-the-new-pssessionconfigurationfile-help-topic
New-PSSessionConfigurationFile has 6 entries–all by Aleksandar.
Register-PSSessionConfiguration has 6 entries (3 active)
None address what I am seeing.
This is an outline of some of the tests and what I get. See the full error in the detail test results below.
Using New-PSSessionConfigurationFile with –SessionType RestrictedRemoteServer:
No language mode set–“UseLocalScope…” error
-LanguageMode NoLanguage–“UseLocalScope…” error
-LanguageMode RestrictedLanguage–“UseLocalScope…” error
-LanguageMode ConstrainedLanguage–“…not recognized as the name of a cmdlet…” error
-LanguageMode FullLanguage–“…not recognized as the name of a cmdlet…” error
Using New-PSSessionConfigurationFile WITHOUT –SessionType RestrictedRemoteServer:
-LanguageMode NoLanguage–“UseLocalScope…” error
-LanguageMode RestrictedLanguage–“UseLocalScope…” error
-LanguageMode ConstrainedLanguage–“…running scripts is disabled on this system…” error (Adding ‘-ExecutionPolicy RemoteSigned’ as a parameter to New-PSSessionConfigurationFile is required even if the local machine execution policy is RemoteSigned)
-LanguageMode FullLanguage–“…running scripts is disabled on this system…” error (Adding ‘-ExecutionPolicy RemoteSigned’ as a parameter to New-PSSessionConfigurationFile is required even if the local machine execution policy is RemoteSigned)
-SessionType RestrictedRemoteServer moved to Register-PSSessionConfiguration:
Using minimal New-PSSessionConfigurationFile parameters–“Cannot bind parameter ‘SessionType’…” error
Without New-PSSessionConfigurationFile at all–“Cannot bind parameter ‘SessionType’…” error
ON REMOTE MACHINE…
PS C:\Scripts> Get-ExecutionPolicy -List | ft -AutoSize
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Unrestricted (This is for the tests only and is normally RemoteSigned or stricter)
PS C:\Scripts> gci C:\Scripts\Set-*.ps1
Directory: C:\Scripts
Mode LastWriteTime Length Name
-a— 8/2/2013 11:03 AM 50045 Set-ReferenceInfoTemplate-Update-IT.ps1
DETAIL TEST RESULTS FOLLOW
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-SessionType RestrictedRemoteServer `
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : UseLocalScope cannot be false when language mode is RestrictedLanguage or NoLanguage.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode NoLanguage -SessionType RestrictedRemoteServer
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : UseLocalScope cannot be false when language mode is RestrictedLanguage or NoLanguage.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode RestrictedLanguage -SessionType RestrictedRemoteServer
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : UseLocalScope cannot be false when language mode is RestrictedLanguage or NoLanguage.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode ConstrainedLanguage -SessionType RestrictedRemoteServer
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : The term ‘C:\Scripts\Set-ReferenceInfoTemplate-Update-IT.ps1’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode FullLanguage -SessionType RestrictedRemoteServer
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : The term ‘C:\Scripts\Set-ReferenceInfoTemplate-Update-IT.ps1’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode NoLanguage `
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : UseLocalScope cannot be false when language mode is RestrictedLanguage or NoLanguage.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode RestrictedLanguage `
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : UseLocalScope cannot be false when language mode is RestrictedLanguage or NoLanguage.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode ConstrainedLanguage `
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : File C:\Scripts\Set-ReferenceInfoTemplate-Update-IT.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at about Execution Policies - PowerShell | Microsoft Docs.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
-LanguageMode FullLanguage `
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-Force
Enable-PSSessionConfiguration -Name $PSSessionName -Force
ON LOCAL/CLIENT MACHINE…
PS C:\Windows\system32> $s = New-PSSession -ComputerName remotedev1 -ConfigurationName testVPSessionConfiguration
New-PSSession : File C:\Scripts\Set-ReferenceInfoTemplate-Update-IT.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at about Execution Policies - PowerShell | Microsoft Docs.
At line:1 char:6
ON REMOTE MACHINE…
New-PSSessionConfigurationFile -Path $sessionConfigFile -Author "someone"
-CompanyName “somewhere” -Copyright 2013 -Description $endpointDescription
Register-PSSessionConfiguration -Name $PSSessionName -Path $sessionConfigFile
-AccessMode Remote -RunAsCredential (Get-Credential -Message "Enter credentials for user that the session endpoint will run as." -UserName $runAsUser)
-SecurityDescriptorSDDL $sddl -StartupScript $scriptToRun
-SessionType RestrictedRemoteServer `
-Force
On the remote server I get the error:
Register-PSSessionConfiguration : Cannot bind parameter ‘SessionType’. Cannot convert value “RestrictedRemoteServer” to type “System.Management.Automation.Runspaces.PSSessionType”. Error: “Unable to match the identifier name RestrictedRemoteServer to a valid enumerator name. Specify one of the following enumerator names and try again: DefaultRemoteShell, Workflow”
At line:12 char:18
ON REMOTE MACHINE…
Register-PSSessionConfiguration -Name $PSSessionName -AccessMode Remote
-RunAsCredential (Get-Credential -Message “Enter credentials for user that the session endpoint will run as.” -UserName $runAsUser) -SecurityDescriptorSDDL $sddl
-StartupScript $scriptToRun -SessionType RestrictedRemoteServer
-Force
On the remote server I get the error:
Register-PSSessionConfiguration : Cannot bind parameter ‘SessionType’. Cannot convert value “RestrictedRemoteServer” to type “System.Management.Automation.Runspaces.PSSessionType”. Error: “Unable to match the identifier name RestrictedRemoteServer to a valid enumerator name. Specify one of the following enumerator names and try again: DefaultRemoteShell, Workflow”
At line:6 char:18
Any additional tests you think would be helpfull?
Steve