PowerShell 远程处理:WinRM 客户端无法处理请求

Nat*_*ret 5 networking remote-desktop powershell command-line

我使用以下命令在远程计算机上设置远程 PowerShell 访问:

Enable-PSRemoting -Force
Set-Item wsman:\localhost\Client\TrustedHosts -value '*' -Force
Get-Item wsman:\localhost\Client\TrustedHosts

   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client

Type            Name                           SourceOfValue   Value
----            ----                           -------------   -----
System.String   TrustedHosts                   GPO             *
Run Code Online (Sandbox Code Playgroud)

他们似乎工作得很好。

但是,当尝试打开 PowerShell 会话时,我收到以下错误:

New-PSSession -ComputerName 10.155.40.10
New-PSSession : [10.155.40.10] Connecting to remote server 10.155.40.10 failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ComputerName 10.155.40.10
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OpenError: (System.Management.A\u2026tion.RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : ServerNotTrusted,PSSessionOpenFailed
Run Code Online (Sandbox Code Playgroud)

但是,使用 RDP 对远程计算机执行 ping 操作和访问均有效:

Test-Connection 10.155.40.10
Pinging 10.155.40.10 [10.155.40.10] with 32 bytes of data:
Reply from 10.155.40.10: bytes=32 time=4ms TTL=125
Reply from 10.155.40.10: bytes=32 time=4ms TTL=125
Reply from 10.155.40.10: bytes=32 time=4ms TTL=125
Reply from 10.155.40.10: bytes=32 time=4ms TTL=125
Ping complete.

Source    Destination  Replies
------    -----------  -------
XXXXXXX   10.155.40.10 {System.Net.NetworkInformation.PingReply, System.Net.NetworkInformation.PingReply, System.Net.NetworkInformation.PingReply, System.Net.NetworkInformation.PingReply}
Run Code Online (Sandbox Code Playgroud)

知道为什么我仍然无法打开 PowerShell 会话吗?

pos*_*ote 4

Ping 和 RDP 与 PowerShell 远程处理无关。

\n\n

您并不是说这些目标是否已加入域(单林/多林等)或工作组。在域中,您应该只需要使用 GPO 来启用 PSRemoting,而不需要受信任的主机内容,除非您正在处理不受信任的域。

\n\n

工作组 PowerShell Remoting 需要更多设置目标和源。关于许多用例级别,整个网络都有详细记录。

\n\n

从我的资料库中保存了指针...

\n\n

提示:使用 Windows PowerShell 远程工作,而不使用远程处理或 WinRM

\n\n
# On the remote computer \n# "Run as administrator" option\n\n# Network adapters cannot be set to public, they must be set to private\n((Get-NetConnectionProfile).InterfaceAlias)[1] | \nSet-NetConnectionProfile -InterfaceAlias $PSItem -NetworkCategory Private\n\n<#\nOr change this in the registry\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkList\\Profiles\n#>\n\n# Set WSMan\nSet-WSManQuickConfig \n\n# Enable Remoting\nEnable-PSRemoting -SkipNetworkProfileCheck -Force\n\n# Set the firewall\nSet-NetFirewallRule \xe2\x80\x93Name "WINRM-HTTP-In-TCP-PUBLIC" \xe2\x80\x93RemoteAddress Any\n\n\n# On the local computer\nwinrm set winrm/config/client @{TrustedHosts="10.0.2.33"}\nSet-Item WSMan:\\localhost\\Client\\TrustedHosts -Value "10.0.2.33" -Force\nGet-Item WSMan:\\localhost\\Client\\TrustedHosts\n
Run Code Online (Sandbox Code Playgroud)\n\n

在独立(工作组)计算机上启用 PowerShell 远程处理

\n\n

两台工作组计算机之间的 PowerShell 远程处理

\n\n

独立工作组计算机之间的 POWERSHELL PS 远程连接

\n\n

两台工作组计算机之间的 PowerShell 远程处理

\n\n

在工作组计算机上启用远程 Powershell

\n\n

如何在工作组非域环境中设置 WinRM

\n\n

了解 WinRM 连接和身份验证并进行故障排除:刺激寻求者的冒险指南

\n\n

WinRM(Windows 远程管理)故障排除提示

\n\n

使用 PowerShell\xe2\x80\x94 对 WinRM 进行故障排除第 1 部分

\n\n

使用 PowerShell\xe2\x80\x94 对 WinRM 进行故障排除第 2 部分

\n\n

了解如何轻松排除 PowerShell 远程故障

\n\n

关于远程故障排除

\n\n

没有管理员权限的 PowerShell 远程处理

\n\n

非管理员用户通过 WinRM 进行 PowerShell 远程处理

\n\n

通过 HTTPS 配置 WinRM 以启用 PowerShell 远程处理

\n\n

启用多跳远程处理

\n\n

启用 PowerShell 双跳远程处理

\n\n

解决 PowerShell 远程处理中的双跃点问题

\n\n

PowerShell 远程 Kerberos 双跳安全解决

\n\n

PowerShell 远程处理使用什么端口?

\n\n

Windows PowerShell:隐式远程处理

\n\n

Windows PowerShell:深入研究远程处理

\n