PowerShell Linux 上缺少 WSMan 提供程序(用于使用远程处理)

PowerShell Linux 上缺少 WSMan 提供程序(用于使用远程处理)

我正在尝试将 PowerShell 从 Linux 远程传输到 Azure 上的 Windows Nano Server。

说明中有一部分我将远程服务器的 IP 添加到本地计算机的受信任主机:

PS > Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value "1.2.3.4"                                          
Set-Item : Cannot find drive. A drive with the name 'WSMan' does not exist.
At line:1 char:1
+ Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value "1.2.3 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (WSMan:String) [Set-Item], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetItemCommand

如果我忽略此消息并尝试连接,则会收到错误:

PS > Enter-PSSession -ComputerName "1.2.3.4" -Credential joe -Authentication Basic -Verbose -Port 5985
Windows PowerShell credential request
Enter your credentials.
Password for user joe: **************

Enter-PSSession : Connecting to remote server 1.2.3.4 failed with the following error message : Authentication Failure For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName "1.2.3.4" -Credential joe -Aut ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (1.2.3.4:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

关于添加 WSMan 提供程序,我所看到的只是我需要运行Enable-PSRemoting,它在我的 Linux PowerShell 上不存在,而且似乎是为远程计算机设计的(并且 Nano Server 默认启用了它)。

相关内容