windows 使用 winrm 连接到远程服务器而不将服务器添加到 TrustedHosts
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12746844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connect to remote server using winrm without adding the server to TrustedHosts
提问by Ivaylo Strandjev
I have been struggling to deal with winrm and TrustedHosts but to no avail. After some experimenting I found out the this field of winrm/config/client is limited up to 1023 symbols which is way not enough especially if adding hosts by their ipv6.
I quote from Installation and Configuration for Windows Remote Management: A trusted hosts list should be set up when mutual authentication cannot be established.
我一直在努力处理 winrm 和 TrustedHosts 但无济于事。经过一些实验,我发现 winrm/config/client 的这个字段被限制为最多 1023 个符号,这还不够,特别是如果通过它们的 ipv6 添加主机。我引用了 Windows 远程管理的安装和配置:A trusted hosts list should be set up when mutual authentication cannot be established.
Also in the same file the text says: Other computers in a workgroup or computers in a different domain should be added to this list.So I thought that this implies that as long as two computers are in the same domain, I should be able to access one of them from the other using winrm.
同样在同一个文件中,文本说:Other computers in a workgroup or computers in a different domain should be added to this list.所以我认为这意味着只要两台计算机在同一个域中,我就应该能够使用 winrm 从另一台计算机访问其中一台。
I tried to add two computers to a test domain and the executed:
我尝试将两台计算机添加到测试域并执行:
winrm get winrm/config/client -r:192.168.100.1 -u:user -p:pass
winrm 获取 winrm/config/client -r:192.168.100.1 -u:user -p:pass
From one of them to the other, but this failed with the error:
从其中一个到另一个,但这失败并出现错误:
WSManFault
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 ad
ded to the TrustedHosts configuration setting. Use winrm.cmd to configure Truste
dHosts. You can get more information about that by running the following command
: winrm help config.
Error number: -2144108316 0x803380E4
The WinRM client cannot process the request. If the authentication scheme is dif
ferent 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 Tru
stedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. You ca
n get more information about that by running the following command: winrm help c
onfig.
After adding 192.168.100.1 to TrustedHosts the query above succeeds. So my question is: is it possible to use winrm between two hosts without modifying TrustedHosts? Setting Trusted hosts to *is not an option for me.
将 192.168.100.1 添加到 TrustedHosts 后,上述查询成功。所以我的问题是:是否可以在不修改 TrustedHosts 的情况下在两台主机之间使用 winrm?将受信任的主机设置*为对我来说不是一个选项。
回答by TesterJeff
If both machines are on the same domain, you should be able to use the ComputerName instead of the IP address. When you use the IP address you're pretty much forced to use TrustedHosts from what I've seen.
如果两台机器在同一个域中,您应该能够使用 ComputerName 而不是 IP 地址。根据我所见,当您使用 IP 地址时,您几乎被迫使用 TrustedHosts。

