gpt4 book ai didi

powershell - WinRM 无法处理请求 - 仅在特定域上失败

转载 作者:行者123 更新时间:2023-12-03 23:21:54 27 4
gpt4 key购买 nike

我们的一些服务器 (W2K8 R2) 上周移到了云端,一旦完成,我的 powerswell 脚本开始失败(之前工作正常),在尝试建立连接的线路上抛出异常,

$ExSession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri     "http://$g_strExchangeServer/PowerShell" `
-Credential $Credentials –Authentication Kerberos

通过以下消息,
[subd.staging.com] Connecting to remote server failed with the following error message : 
**WinRM cannot process the request**. The following error occured while using Kerberos authentication: There are currently no logon servers available to service the logon request.
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 onfig. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed

只有当我尝试定位我们的测试域时才会发生这种情况,如果我将脚本指向我们的生产域,那么它就可以工作。

在已移至云端的所有服务器上都显示相同的错误。

请注意,所有尚未迁移到云的服务器都能够在两个域上运行脚本而不会出现任何问题。

我试过以下,但没有运气。
//Add the destination computer to the WinRM TrustedHosts configuration setting. 
c:\>WinRM set winrm/config/client @{TrustedHosts="stagingserver"}


//Confirm that WinRM is properly configured.
c:\>Winrm quickconfig

//Make sure that the remote server allows commands from any machine.
PS c:\>Set-item wsman:localhost\client\trustedhosts -value *

使用 Powershell v2 和 WinRM v2

欢迎提出任何意见。

最佳答案

在客户端机器上运行这些命令,然后尝试访问远程主机:

首先我们需要检查客户端机器上的 TrustedHosts:

PS C:\> WinRM get winrm/config/client
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = false
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts

如果示例中为空,请在 上运行以下命令客户机器:

PS C:> Set-item wsman:localhost\client\trustedhosts -value *

这将在 TrustedHosts 参数中写入 * 这将允许客户端计算机连接到任何主机,或者您可以使用目标服务器的 ip 和/或主机名配置此值。
PS C:\> WinRM get winrm/config/client
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = false
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts = *

关于powershell - WinRM 无法处理请求 - 仅在特定域上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18284132/

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