【问题标题】:Connect to Exchange server using powershell使用 powershell 连接到 Exchange 服务器
【发布时间】:2018-01-31 04:44:18
【问题描述】:

我尝试运行以下脚本以连接到 Exchange 服务器,但出现以下错误。剧本有什么问题吗?是否需要从服务器端进行任何更改?

Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://mail.company.tld/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

错误:

New-PSSession : [mail.deloitte.ca] Connecting to remote server mail.deloitte.ca failed with the following error message : The WinRM client sent a request to an HTTP 
server and got a response saying the requested HTTP URL was not available. This is usually returned by a HTTP server that does not support the WS-Management protocol. 
For more information, see the about_Remote_Troubleshooting Help topic.
At line:4 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed

【问题讨论】:

  • 您应该从问题中的 URL 中删除公司名称。
  • 服务器/客户端上运行的是什么Powershell版本?

标签: powershell


【解决方案1】:

您是否检查过this document 中提到的 PowerShellVirtualDirectory?它提到了完全相同的问题。

【讨论】:

    【解决方案2】:

    假设您的 ConnectionUri 是正确的,很可能没有在目标 CAS 服务器上启用 PowerShell 远程处理。您可以通过直接在 CAS 服务器上运行它来启用它:

    Enable-PSRemoting
    

    可能还需要配置 PowerShell 虚拟目录:

    Set-PowerShellVirtualDirectory "[ServerName]\POWERSHELL (default web site)" -BasicAuthentication $true
    

    【讨论】:

      猜你喜欢
      • 2020-12-20
      • 2012-09-06
      • 1970-01-01
      • 2020-05-22
      • 2020-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多