我目前正在处理一个连接到我们的邮件服务器的脚本,并清除邮箱中的特定文件夹,除了连接到服务器之外,所有的工作都没有问题。 当我今天上午尝试时没有问题。 但是,如果我现在尝试我得到
The WinRM service cannot process the request because the request needs to be sent to a different machine. Use the redirect information to send the request to a new machine. Redirect location reported: h ttps://mail.mailserver.se/owa/PowerShell . To automatically connect to the redirected URI, verify the "MaximumConnectionRedirectionCount" property of the session preference variable "PSSessionOption", and use the "AllowRedirection" p arameter on the cmdlet. At line:5 char:12 + $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ht ...
当我尝试使用https://mail.mailserver.se/Owa/PowerShell时 ,吐出了:
New-PSSession : [mail.mailserver.se] Connecting to remote server mail.bluestep.se failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: The computer mail.bluestep.se is unknown to Kerberos. Verify that the computer exists on the network, that the name provided is spelled correctly, and that the Kerberos configuration for a ccessing the computer is correct. The most common Kerberos configuration issue is that an SPN with the format HTTP/mail.mailserver.se is not configured for the target. If Kerberos is not required, specify th e Negotiate authentication mechanism and resubmit the operation. For more information, see the about_Remote_Troubleshooting Help topic.
这是代码连接部分的一部分。
$password = "MyPasswordHere" $UserName = "domain\username" $Credentials = New-Object System.Management.Automation.PSCredential("domain\username", $password) $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://Mailserver/PowerShell/ -Authentication Kerberos -Credential $Credentials Import-PSSession $Session -AllowClobber
请原谅,如果我错过了一些东西,或者如果这不清楚。
find解决scheme
如果我添加“启用-PSRemoting -Force”它的作品。 看起来像WinRM wasent运行。
你使用多个服务器负载平衡?
似乎你使用外部的URI来访问PS。 我没有使用公共uri来访问ps呢。 从一个服务器到另一个服务器的redirect会导致相同的uri,而负载平衡器上的粘滞会话会再次将您redirect到返回redirect的服务器(这将导致另一个redirect)。
尝试使用内部的uri来访问shell。 这可能会解决这个问题。