为什么在远程计算机上使用 PowerShell 调用 Get-Service 时会出现 "Get-WindowSize" not implemented 错误?

Why do I get a "Get-WindowSize" not implemented error when using the PowerShell call Get-Service on a remote machine?

我有一个 Windows 10 主机连接到 Hyper-V Windows 10 VM 托管在同一个盒子上。 我一直在关注 Pluralsight PowerShell 教程。 我正在尝试获取远程计算机上可用的服务。

我可以使用以下命令在远程计算机上启动会话:

Enter-PSSession -ComputerName Client1 -Credential username

会话启动并连接后,我尝试调用 Get-Service 来识别客户端计算机上的服务。

[Client1]: PS C:\Users\username\Documents>Get-Service

当我运行执行上述命令时,我收到以下错误消息:

Remote host method get_WindowSize is not implemented.
    + CategoryInfo          : ResourceUnavailable: (:) [out-lineoutput], PSRemotingDataStructureException
    + FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException,Microsoft.PowerShell.Commands.OutLineOutputCommand

我运行在主机和客户端计算机上使用相同版本的 PowerShell (5.1.18362.145)。 我假设这是客户端计算机上的一个问题?

[Client1]: PS C:\Users\username\Documents>获取服务 |外串

应该可以,可能是 PowerShell 的错误或 Windows10

的新版本

其他 link : https://social.technet.microsoft.com/Forums/en-US/67142783-2acd-4d54-aef2-8d89d71457c5/powershell-remoting-broken-in-windows-10-1903?forum=winserverTS

"Remote host method get_WindowSize is not implemented."

客户端的所有 以 Powershell_ISE 开始的远程处理会话都会发生这种情况。 Out-String 的解决方法很糟糕,它破坏了该调用的结果对象。 到目前为止最好的解决方法是不使用 ISE 或将您的远程过程嵌入脚本中并使用 Powershell.exe

调用它

真的很烦人...现在还没有解决。

解决方法示例: 您可以使用:$YourServices=Invoke-command -ComputerName <computername> -ScriptBlock {get-service} 而不是使用 enter-pssession 然后请求 运行 服务的结果。然后您的对象 $YourServices.

中包含所有服务统计信息