powershell - 使用 Connect-WSMan 会出现错误 : It cannot determine the content type of the HTTP response from the destination computer

标签 powershell exchange-server powershell-remoting winrm

我正在尝试使用 PowerShell 通过 wsman 连接连接到 Exchange 服务器。有问题的客户端服务器位于工作组中,而 Exchange 服务器位于其自己的域中。

我使用以下命令尝试连接到服务器:

connect-wsman -connectionuri http://servername/PowerShell -credential domain\administrator

然后我得到完整的错误:

Connecting to remote server failed with the following error message: The WinRM client cannot process the request. It cannot determine the content type of the HTTP response from the destination computer. The content type is absent or invalid. For more information, see the about_Remote_Troubleshooting Help topic.



以前,当有问题的客户端服务器与 Exchange 服务器在同一个域中时,这会起作用。防火墙关闭,所有服务器都是 WinRM 的 TrustedHosts。

有趣的是,当我使用:
connect-wsman -computername servername -credential domain\administrator

我没有收到任何错误。但是,我需要能够使用 URI 而不是计算机名称。

有任何想法吗?

最佳答案

为了在交换服务器上工作,我使用了另一种方法 New-PSSession到我的交换服务器和 Import-PSSession在本地加载远程交换功能

$PSExchSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "http://$($Exch.dNSHostName)/PowerShell/" -Credential (Get-CredentialByRegistry "$AD\Administrateur") -Authentication Kerberos
Import-PSSession $PSExchSession -CommandName 'Get-Mailbox','Get-MailboxStatistics','Get-ActiveSyncDeviceStatistics' -AllowClobber

关于powershell - 使用 Connect-WSMan 会出现错误 : It cannot determine the content type of the HTTP response from the destination computer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24090954/

相关文章:

powershell - 在 cmd 和 INFO : Could not find files for the given pattern(s) 下执行 powershell 命令

php - 发送带有附件的自动电子邮件时,有时文件会重复

smtp - 为什么要说服开发人员使用端口587进行所有SMTP通信?

powershell - Powershell:如何获取通讯组的完整列表

powershell远程处理: very slow

powershell - PSSession 不会更改工作目录

powershell - 本地服务器上的 Invoke-RestMethod 身份验证失败

azure - Mac 中的 Powershell 问题

powershell - 隐藏Powershell输出

powershell - Powershell远程执行速度极慢?