无法将 Enter-PSSession 与 PowerShell 远程端点一起使用

无法将 Enter-PSSession 与 PowerShell 远程端点一起使用

我正在按照本指南进行配置,注册,然后进入受限的 PowerShell 远程端点 -https://blogs.technet.microsoft.com/heyscriptingguy/2014/04/01/build-constrained-powershell-endpoint-using-startup-script/

我按照文档进行操作,但在尝试进入 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

我正在使用时注册此启动脚本Register-PSSession-http://pasted.co/6b152e12

新会话的注册也已完成,注册后,我可以在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                                                                                                   
SerializationVersion           1.1.0.1    

知道可能出了什么问题吗?使用 Windows Server 2016。

相关内容