我正在尝试测试 winrm 是否适用于系统列表;但是,当我尝试连接到系统时,我似乎无法捕捉/消除出现的错误。它似乎适用于一个系统:
PS C:\Users\Egr> winrm id -r:system1
IdentifyResponse
ProtocolVersion = http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor = Microsoft Corporation
ProductVersion = OS: x.x.xxxx SP: x.x Stack: x.x
但不适用于另一个:
PS C:\Users\Egr> winrm id -r:system2
WSManFault
Message = WinRM cannot process the request. The following error occured while using Kerberos authentication: The net
work path was not found.
Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
-The client and remote computers are in different domains and there is no trust between the two domains.
After checking for the above issues, try the following:
-Check the Event Viewer for events related to authentication.
-Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use
HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.
-For more information about WinRM configuration, run the following command: winrm help config.
Error number: -2147024843 0x80070035
The network path was not found.
我已经尝试将它包围在一个 try/catch 块中,但它似乎并没有让它静音。我正在尝试对这些系统进行检查,以确定哪些系统正确配置了 WinRM 并正常工作;但是如果脚本一直输出这个文本,它就不会很好地工作。有什么方法可以抑制这个文本,还是有更好的方法来测试 WinRM 连接?