通过HTTPS从PowerShell远程连接连接Exchange服务器

问题描述:

我试图解决我们正面临的问题。通过HTTPS从PowerShell远程连接连接Exchange服务器

我们能够通过winRM HTTP身份验证从远程计算机与Exchange Server EMS脚本进行通信。

$newSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://test.domain.com/PowerShell/ -Authentication Kerberos -Credential $Credentials  
Import-PSSession $newSession 

但我们必须实行WinRM的HTTPS,对于包括证书创建要求,所以我已经设置好一切,WinRM的设置等

,我们能够连接到远程计算机,其中交换服务器可用:

输入-的PSSession -ComputerName test.domain.com -Credential $凭据-UseSSL

和工作原理。

现在,当我在新的PSSession使用-UseSSL /输入-的PSSession的EMS,它不工作:

$newSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://test.domain.com/PowerShell/ -Credential $Credentials -UseSSL 

Error: New-PSSession : Parameter set cannot be resolved using the specified named parameters.

请注意:我需要WinRM的(PowerShell中)连接通过HTTPS : - 使用SSL身份验证。不使用Kerberos/Defaut/CredSSP的

你需要看看参数集的文档https://technet.microsoft.com/en-us/library/hh849717.aspx例如,在当你使用URI如

Parameter Set: Uri New-PSSession [-ConnectionUri] [-AllowRedirection] [-Authentication {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos} ] [-CertificateThumbprint ] [-ConfigurationName ] [-Credential ] [-EnableNetworkAccess] [-Name ] [-SessionOption ] [-ThrottleLimit ] [ ]

什么,你应该做的是指定https前缀,而不是使用-useSSL开关,它将确保连接通过https(“https://test.domain.com/PowerShell/)”。-useSSL用于在使用-Co​​mputerName参数时使用。