我正在尝试使用以下脚本通过命令提示符配置HTTPS端口打开以进行网络通信。当我将主机名指定为当前计算机名并指定指纹时,它的效果很好!!但是,如果我想使此命令更通用,那么可以在任何计算机上使用该命令并自动获取主机名和缩略图,则此命令将无效。
请为您提供帮助。
尝试:
>winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname= "Get-DnsClient"; CertificateThumbprint="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
获取错误
Error number: -2144108311 0x803380E9
The WinRM client cannot process the request. The certificate CN and the hostname that were provided do not match
.----(如果我指定了实际指纹,只需将主机名更改为自定义值)
也尝试过
winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname= $LocalhostFQDN; CertificateThumbprint=$CertThumbPrint}
获取错误
Syntax Error: input must be of the form {KEY="VALUE"[;KEY="VALUE"]}
我希望输出的结果是运行通用命令时(不输入机器名和指纹)
ResourceCreated
Address = http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
ReferenceParameters
ResourceURI = http://schemas.microsoft.com/wbem/wsman/1/config/listener
SelectorSet
Selector: Address = *, Transport = HTTPS