Tuesday, 18 October 2016

Connecting to remote server failed with the following error message - ps.outlook.com

Problem:

I am receiving the error '[ps.outlook.com] Connecting to remote server failed with the following error message : The SSL connection cannot be established' when I try to connect remote Exchange Online powershell by using below command.
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred - 
Authentication Basic -AllowRedirection
Import-PSSession $O365Session
Error Message:
[ps.outlook.com] Connecting to remote server failed with the following error message : The SSL connection cannot be established. Verify that the service on the remote host is properly 
configured to listen for HTTPS requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is 
the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig -transport:https". For more information, see the about_Re
mote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
    + FullyQualifiedErrorId : PSSessionOpenFailed

Fix/Solution:

For me the problem was fixed after changing the Exchange Online ConnectionUri https://ps.outlook.com/powershell as https://outlook.office365.com/powershell-liveid/. The below command is working fine for me now.
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session

Advertisements
Advertisements

No comments:

Post a Comment