【发布时间】:2018-08-23 08:28:16
【问题描述】:
我正在尝试远程执行Powershell命令,我的问题是使用的Powershell是4.0版本,我想使用Powershell Core 6.0.4远程执行我的命令。
我尝试在远程主机上使用这个命令
Set-PSSessionConfiguration -name microsoft.powershell -psversion 6.0 -FORCE
得到这个错误:
Set-PSSessionConfiguration : Cannot bind parameter 'PSVersion' to the target. Exception setting "PSVersion": "The
value 6.0 is not valid for the PSVersion parameter. The available values are 2.0,3.0 and 4.0."
我的远程机器上安装了 6.0.4 版。
我知道它使用版本 4 来执行我的远程命令,因为
Invoke-Command -Session $session -ScriptBlock {$PSVersionTable.PSVersion};
返回:
Major Minor Build Revision PSComputerName
----- ----- ----- -------- --------------
4 0 -1 -1 IIS-DEV2
任何想法如何强制它使用版本 6?
【问题讨论】:
-
Install-PowerShellRemoting.ps1应该是 PowerShell Core 安装的一部分。 -
@PetSerAl 不明白你的答案。我像任何其他程序一样安装了powershell核心,你在说什么这个脚本,更具体
-
和任何其他程序安装一样,它会在您的系统中添加一些文件。其中有人应该被命名为
Install-PowerShellRemoting.ps1。
标签: powershell powershell-remoting powershell-core