I am following this guide to configure, register and then Enter the restricted PowerShell Remote Endpoint - https://blogs.technet.microsoft.com/heyscriptingguy/2014/04/01/build-constrained-powershell-endpoint-using-startup-script/

I am following the documentation as it is but I am getting the following error when trying to enter the PSSession -

PS C:\Windows\system32> Enter-PSSession -ComputerName $env:Computername -ConfigurationName ConstrainedSession -Verbose
Enter-PSSession : Exception calling "GetSteppablePipeline" with "1" argument(s): "The expression after '&' in a pipeline element 
produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object."
At line:1 char:1
+ Enter-PSSession -ComputerName $env:Computername -ConfigurationName Co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Enter-PSSession], MethodInvocationException
    + FullyQualifiedErrorId : RuntimeException

I am registering this startup script while using Register-PSSession - http://pasted.co/6b152e12

The registration of the new session also goes through and once registered, I can see the session in Get-PSSessionConfiguration

PS C:\Windows\system32> $PSVersionTable

Name                           Value                                                                                                 
----                           -----                                                                                                 
PSVersion                      5.1.14393.1715                                                                                        
PSEdition                      Desktop                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                               
BuildVersion                   10.0.14393.1715                                                                                       
CLRVersion                     4.0.30319.42000                                                                                       
WSManStackVersion              3.0                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                   

Any idea what might be going wrong? Using Windows Server 2016.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.