我需要放弃基本身份验证,开始使用另一种方式来执行我的 powershell 脚本。问题是我无法让它工作。我对此很菜鸟,所以我不知道下一步该怎么做。
我通常的做法是:
enter-pssession servernameA
现在它会引发一个错误:
Connecting to remote server servernameA failed with the following error message : The client cannot c
onnect to the destination specified in the request. Verify that the service on the destination is running and is accept
ing requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonl
y IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and co
nfigure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (servernameA:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken
我首先确保 SPN 已创建,并且一切似乎都很好:
setspn -l servernameA
WSMAN/servernameA
WSMAN/servernameA.mydomain
然后我根据错误消息的建议运行了 winrm quickconfig:
winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
我是否忽略了某些显而易见的东西,或者它是否因给用户带来问题而臭名昭著?
Get-WSManInstance winrm/config/listener -Enumerate
cfg : http://schemas.microsoft.com/wbem/wsman/1/config/listener
xsi : http://www.w3.org/2001/XMLSchema-instance
lang : en-US
Address : *
Transport : HTTP
Port : 5985
Hostname :
Enabled : true
URLPrefix : wsman
CertificateThumbprint :
ListeningOn : {xx.xxx.xxx.xxx, 127.0.0.1, ::1}