PowershellCore 连接到 Powershell 5.1 远程计算机?

问题描述

我想知道是否可以从 Powershell 6/7 在仅安装了 Powershell 5.1 的主机上启动远程会话(这样我就可以访问一些无法迁移到 Powershell 6 的 Powershell 5.1 功能/7) ?

问候,

解决方法

要在远程计算机上明确定位 Windows PowerShell 会话(版本最高为 v5.1),请使用
例如,-ConfigurationName Microsoft.PowershellInvoke-Command

事实上,从 PowerShell 7.1 开始,这仍然是 PowerShell 远程命令目标的默认版本,如 preference variable $PSSessionConfigurationName 所示。

有关详细信息,请参阅 this post