gpt4 book ai didi

Powershell 远程处理和 WinRM

转载 作者:行者123 更新时间:2023-12-02 17:26:07 26 4
gpt4 key购买 nike

New-PSSession 在使用服务器的主机名时不起作用,但在使用 IP 时起作用。本地和远程计算机都在同一域中。

PS C:\Windows\system32> new-PSSession -ComputerName "SERVERNAME" new-PSSession : [SERVERNAME] Connecting to remote server SERVERNAME failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer SERVERNAME. Verify that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic.

我还尝试过 Ping、RDP 和 Test-WSMan,使用服务器主机名都成功。

对于可能出现的问题有什么想法吗?

最佳答案

似乎是 SelfSignedCertificate 问题。

删除旧的 WinRM 监听器

winrm delete winrm/config/Listener?Address=*+Transport=HTTPS

使用域名创建新的自签名证书

New-SelfSignedCertificate -DnsName "<YOUR_DNS_NAME>" -CertStoreLocation Cert:\LocalMachine\My

更新 SelfSignedCertificate _THUMBPRINT

winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="<YOUR_DNS_NAME>"; CertificateThumbprint="<COPIED_CERTIFICATE_THUMBPRINT>"

3.添加新的防火墙规则

$port=5986
netsh advfirewall firewall add rule name="Windows Remote Management (HTTPS-In)" dir=in action=allow protocol=TCP localport=$port

请参阅此链接了解更多信息:

http://www.visualstudiogeeks.com/devops/how-to-configure-winrm-for-https-manually

关于Powershell 远程处理和 WinRM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43594768/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com