Connecting to Exchange Online with remote PowerShell from a Mac

Yes! it is finally possible to connect to Exchange Online from PowerShell installed on MacOS. I noticed some tweets about this being possible on Linux earlier in the week so I thought I’d re-visit testing it on MacOS. PowerShell remoting has been available in the MacOs version since powershell-6.0.0-alpha.15, but it didn’t include the ability to specify a “ConnectionUri’ as the endpoint – it only worked with server names and IP addresses. powershell-6.0.0-alpha.17 which was recently released now includes this functionality.

The first thing you need to do it download and install the latest release from here, you’ll want to download at least powershell-6.0.0-alpha.17

Screen Shot 2017-03-15 at 3.47.08 PM

Next launch PowerShell and confirm the version:


Screen Shot 2017-03-15 at 4.31.53 PM

We are now ready to run establish our remote session. First let’s define our credentials:

$UserCredential = Get-Credential

Then create the session:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

And finally, import that session:

Import-PSSession $Session

Screen Shot 2017-03-15 at 4.41.16 PM

Once connected you have all the Exchange Online cmdlets available to you:

Screen Shot 2017-03-15 at 4.46.02 PM

I haven’t thoroughly tested it yet, but I look forward to spending some time using it soon!

Share this?Print this pageEmail to someoneTweet about this on TwitterShare on LinkedInShare on FacebookDigg thisGoogle+Pin on PinterestShare on StumbleUponShare on Redditshare on TumblrBuffer this pageFlattr the author

Post navigation


  • Martin

    Thank you very much! At last i can leave MS totally 🙂 Works perfectly!!

  • Sascha

    Thanks for this post!

    First, I would like to inform you, that your command for creating the session contains an “a href”-tag, which produces an error.

    But even if I use the right command:

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

    I get an error:

    Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
    at System.Management.Automation.Remoting.PrioritySendDataCollection.Clear()
    at System.Management.Automation.Remoting.Client.BaseClientTransportManager.CloseAsync()
    at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.CloseAsync()
    at System.Management.Automation.Remoting.Client.BaseClientTransportManager.Finalize()
    Abort trap: 6

    Do you know the reason for that? Thanks.

  • Chris

    Hi Sascha,

    Thanks for the info. I have corrected the code so you should be good to go, I just tested it and it works. I’m not entirely sure why you are receiving the error. Can you confirm the version of PowerShell you are running?



  • Edward Glasheen

    Any word on when PS (Mac) will be available for O365/SharePoint?



  • Chris

    Hi Edward,

    Thanks for the comment. Unfortunately, I don’t know what the current roadmap is for that, but I would venture to guess that we will see something in time. I’ll be sure to add any updated info here when it becomes available.



  • Amanda Debler


    I’ve updated to 6.0.0-beta.2, but still get this error when I run the New-PSSession command:

    New-PSSession : [] Connecting to remote server failed with the following error
    message : Client did not get proper response from server. For more information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:20
    + ... geSession = New-PSSession -ConfigurationName Microsoft.Exchange -Conn ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTranspor
    + FullyQualifiedErrorId : 1,PSSessionOpenFailed

  • Chris

    Hi Amanda,

    Thats an interesting error, are you able to resolve correctly? I haven’t been able to replicate the issue, but it does look like version v6.0.0-beta.3 is out so perhaps upgrading to that will help? It seems to work great for me.

    I’ll keep trying to replicate it and report back if I find anything.

    All the best,


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>