New-ExoPSSession The SSL connection cannot be established

Ahmed Salman 21 Reputation points
2022-03-16T05:51:34.207+00:00

Hi,

I’m getting the below error when I try to connect exchange online using PowerShell from my Server 2012 R2

New-ExoPSSession : Connecting to remote server outlook.office365.com failed with the following error message : The
server certificate on the destination computer (outlook.office365.com:443) has the following errors:
Encountered an internal error in the SSL library. For more information, see the about_Remote_Troubleshooting Help
topic.
At C:\Program
Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.5\netFramework\ExchangeOnlineManagement.psm1:475 char:30

Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,526 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
4,873 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,166 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,355 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 94,911 Reputation points MVP
    2022-03-16T07:11:31.763+00:00

    Make sure you enable TLS1.2 first:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    

    Other than that, make sure you have the latest updates, at minimum the Trusted root CA ones.


  2. KyleXu-MSFT 26,206 Reputation points
    2022-03-17T07:50:28.26+00:00

    @Ahmed Salman

    Whether there exists firewall in your organization, if so, I would suggest you try to disable it temporarily to check whether this phenomenon is caused by it. You need to make sure Office 365 URLs and IP address ranges could access from your client successfully.

    I also suggest you have a check whether there exists proxy setting on your client. If there is, try to remove it and connect to Exchange online again.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    0 comments No comments