windows - 如何使用 winrm 将多台机器添加到受信任的主机列表

标签 windows powershell hosts winrm

要从远程机器在机器上运行 powershell 命令,我们必须将远程机器添加到主机的受信任主机列表中。

我正在使用以下命令将机器 A 添加到机器 B 的受信任主机:

winrm set winrm/config/client ‘@{TrustedHosts="machineA"}’

如何将更多机器如机器C、机器D添加到机器B的可信主机列表中?

最佳答案

我更喜欢使用 PSDrive WSMan:\

获取 TrustedHosts

Get-Item WSMan:\localhost\Client\TrustedHosts

设置 TrustedHosts

提供一个逗号分隔的计算机名称字符串

Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'machineA,machineB'

或(危险的)通配符

Set-Item WSMan:\localhost\Client\TrustedHosts -Value '*'

要追加到列表中,可以使用-Concatenate参数

Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'machineC' -Concatenate

关于windows - 如何使用 winrm 将多台机器添加到受信任的主机列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21548566/

相关文章:

debugging - 进入调试器的 Powershell 语句

webpack - 使用 webpack 开发服务器将 localhost 重命名为自定义域?

safari - 为什么 Safari 无法连接到本地主机?

windows - 将 Git Windows 版本与 Git 源代码管理提供程序一起使用的入门问题

windows - 如何从开发中服务 https Aurelia

c++ - 将批处理文件转换为exe

azure - 如何在 powershell 中规范化此 URL?

Python 在我的脚本中失败到 `import nltk` 但在解释器中工作

windows - 将参数传递给 powershell 脚本

macos - 即使在杀死 mDNSResolver 后,Mac OSX 更改/etc/hosts 也没有任何影响