执行 Enter-PSSession 时出现错误 - 连接到远程服务器失败

发布于 2025-01-20 14:56:29 字数 1362 浏览 5 评论 0原文

我正在尝试远程连接到另一台计算机(aws 工作区)并使用:

Enter-PSSession -ComputerName [IP-ADDRESS] -Credential $cred

但出现错误:

Enter-PSSession : Connecting to remote server [IP-ADDRESS] failed with the following error message : WinRM cannot
complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the
network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By
default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName [IP-ADDRESS] -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: ([IP-ADDRESS]:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

我正在使用的 Ip 地址代替 [IP-ADDRESS] 是正确的。

我已在本地和远程计算机上完成了 winrm Quickconfig 并确认 WinRM 服务已在计算机上运行并设置。

我已经完成了 Set-Item WSMan:\localhost\Client\TrustedHosts * 以便一切都是可信的。

我已尝试编辑 Windows 远程管理 HTTP-In 的入站规则以允许任何 IP 地址,但仍然出现相同的错误。

我可以使用远程桌面连接应用程序启动远程会话,因此这只是尝试通过 Powershell 启动问题的问题

我还需要配置任何其他设置吗?

I'm trying to remote on to another computer (an aws workspace) and using:

Enter-PSSession -ComputerName [IP-ADDRESS] -Credential $cred

But get error:

Enter-PSSession : Connecting to remote server [IP-ADDRESS] failed with the following error message : WinRM cannot
complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the
network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By
default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName [IP-ADDRESS] -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: ([IP-ADDRESS]:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

And the Ip address i am using in place of [IP-ADDRESS] is correct.

I have done winrm quickconfig on both the local and remote machine and confirmed that WinRM service is already running and set up on the computer.

I have done Set-Item WSMan:\localhost\Client\TrustedHosts * so that everything is trusted.

I have tried editing the Inbound rules for Windows Remote Management HTTP-In to allow any IP address but still get the same error.

I can start a remote session using the Remote Desktop Connection application so it is just an issue trying to start an issue through Powershell

Is there any other setting I need to configure?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬花如无物 2025-01-27 14:56:29

如果您只使用“ winrm quickconfig” ..
然后确保您的NetConnectionProfile设置为私有。
要查看配置文件使用“ Get-NetConnection Profile”
如果这是“公共”,则无法建立连接,并且您会收到错误消息。
选项是使用“启用psremoting -skipnetworkprofilecheck”,然后使用它。

If You Just use "winrm quickconfig"..
Then be sure that Your netconnectionprofile is set to Private.
To see the profile use "Get-NetConnectionProfile"
If this is "Public" the connection can't be established and You get the error message.
Option is to use "Enable-PSRemoting -SkipNetworkProfileCheck" then it should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文