0

我試圖解決我們正面臨的問題。通過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的

回答

0

你需要看看參數集的文檔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參數時使用。