none
PowerShell - Error when connecting to O365/Exchange Online RRS feed

  • Question

  • For the longest time I've been using the same code to connect to Office 365, but recently I've been getting the following message when I tried to connect.

    WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer.  By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.

    At line:1 char:16

    + ... 65Session = New-PSSession –ConfigurationName Microsoft.Exchange -Conn ...

    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin

       gTransportException

        + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

    The Powershell script I'm using to connect is as follows:

    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

    Connect-MsolService –Credential $O365Cred

    I confirmed there's no firewall settings or proxy settings that are blocking the connection and I feel it's unlikely to be an issue on the Exchange Online side, so I'm wondering if there was a setting change that I might have missed.

    I also attempted to use the script located at: https://gallery.technet.microsoft.com/Connect-EXOps1-Connect-to-9c3854ea but it always said that the connection failed due to credentials.

    Thursday, April 2, 2020 7:35 PM

All replies

  • Please post O365 issues in the O365 community forum.  

    Your issue can also be addressed by contacting support through your O365 portal. 

    The issue is with your network and may be a result of using a proxy server or other issues that we cannot help with.  As you noted this always worked until just now.  If you didn't change the script or reconfigure your tenement then the issue isi not a PowerShell issue.



    \_(ツ)_/

    Thursday, April 2, 2020 7:48 PM