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 会话吗?
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\nRun Code Online (Sandbox Code Playgroud)\n\n在独立(工作组)计算机上启用 PowerShell 远程处理
\n\n\n\n独立工作组计算机之间的 POWERSHELL PS 远程连接
\n\n\n\n\n\n\n\n了解 WinRM 连接和身份验证并进行故障排除:刺激寻求者的冒险指南
\n\n\n\n使用 PowerShell\xe2\x80\x94 对 WinRM 进行故障排除第 1 部分
\n\n使用 PowerShell\xe2\x80\x94 对 WinRM 进行故障排除第 2 部分
\n\n\n\n\n\n\n\n非管理员用户通过 WinRM 进行 PowerShell 远程处理
\n\n通过 HTTPS 配置 WinRM 以启用 PowerShell 远程处理
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n| 归档时间: |
|
| 查看次数: |
19047 次 |
| 最近记录: |