Unable Connect Exchange Remote PowerShell Using Windows 10 Anniversary Update

After updating Windows 10 you may be unable to connect to a remote PowerShell session.  This is an issue for versions of Exchange 2010 onwards as we use remote PowerShell for administration.  The same applies for Exchange Online in Office 365.  Note that directly loading the Exchange PSSnapin is not supported apart from a limited number of documented scenarios, for example this is one of them.  For more details on how Exchange uses PowerShell please read this series of posts.

How To Maximize Exchange Administrator Productivity With PowerShell–Part 1

How To Maximize Exchange Administrator Productivity With PowerShell–Part 2

How To Maximize Exchange Administrator Productivity With PowerShell–Part 3


Let’s look at a quick example of what you may see on a Windows 10 machine when trying to connect to Exchange Online.

Update 26-8-2016: See also PowerShell DSC and implicit remoting broken in KB3176934

Update 2-9-2016: An update to correct the issue has been released.  Please refer to the note in the CU.  To fix this issue, download update 3176938 from the Microsoft Update Catalog website.

Windows 10 Anniversary Edition Repro

Windows PowerShell was launched from its regular shortcut.  In the below example I’m using the simple connection script to connect to Exchange Online.  It will prompt for credentials and then connect.

Connecting to Exchange Online Using Remote PowerShell

All good so far.  After entering the credentials we get the regular warning about the redirection, this is expected so don’t panic!

WARNING: Your connection has been redirected to the following URI:
"https://ps.outlook.com/PowerShell-LiveID?PSVersion=5.1.14393.82 "

However the red text is never a good thing.  Trying to import the PSSession has failed.  Bummer.

Connecting to Exchange Online Using Remote PowerShell - Could Not Import PSSession

For the search engines, the detailed error is:

Import-PSSession : Could not load type 'System.Management.Automation.SecuritySupport' from assembly
'System.Management.Automation, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
At C:\Scripts\Connect-EXO.PS1:6 char:18
+ $ImportResults = Import-PSSession $Session
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Import-PSSession], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportPSSessionCommand


Did the connection really fail?  Let’s see where it got to.  Trying to use Get-Mailbox fails, so that cmdlet is not available to us.

Connecting to Exchange Online Using Remote PowerShell - No Exchange Cmdlets

What about the script module, was that downloaded and created?  We will check using Get-Module.

Connecting to Exchange Online Using Remote PowerShell - No Exchange Script Module

Nope there is no script module which is used to contain the Exchange cmdlets.

For comparison, the below is from a Windows Server 2012 R2 server.  Note the script module which is underlined:

Exchange Online Remote PowerShell - Script Module Present

That is where the Exchange cmdlets are represented as client side functions.  No script module, no function and therefore no cmdlets are available.


Windows 10 PowerShell Details

If we look at the version of PowerShell which is loaded when the Windows PowerShell start menu shortcut is used, we can see that it is a new and updated version of PowerShell.  The PSVersion is reported as 5.1.14393.82.

Windows 10 Anniversary Edition PSVersion Table



While the issue is worked upon by the teams involved, there is a quick workaround.

Rather than using the default instance of PowerShell, we can go old skool and use a downlevel version.  The easiest way is to use the run box to start PowerShell up as version 2.0.  You can click Start, then Run and enter the command.  Alternatively I love to use the Windows Key + R as a keyboard shortcut to get to the Run box.

In the Run box enter:

PowerShell.exe -Version 2.0


Then we connect in the normal way.  In the below example, note that I am showing the OS version and the PowerShell version to prove there is no funny business.

Workaround on Windows 10 Anniversary Edition - Rocking It Old School With PowerShell Version 2.0




Comments (12)
  1. Matt Scott says:

    Thanks for your help! I was puzzled why I could no longer connect to one of my tenants via PS.

  2. Rob Ellis says:

    I’m seeing the same behaviour with the Skype for Business Online module – but trying v2.0 for them I get an error saying it needs version 3.0.

    1. You can try uninstalling the referenced KB 3176934 and see if that resolves the issue in the interim Rob.


  3. David Grand says:

    Ok, thanks for confirming that we have a problem here. I run scripts all the time against our tenancy and I need this to work. I will move to my management station until this gets resolved. Thank you, once again.

  4. i noticed 365 connects with powershell 2.0 but msonline module doesn’t load…

  5. Tony Morrissey says:

    On Windows 10 Anniversary, when update (KB3176934) is installed, I cannot connect to Exchange Online. If I remove the update, I can connect to Exchange Online.

    1. Yes – that’s the KB that is listed above.


  6. Adam Polter says:

    Thank you Rhoderick! I was working with Exchange Online help just today and that is when I discovered Powershell would not work from my Windows 10 Pro laptop. Had to RDP into a server to get the job done. Your workaround was successful! Hopefull MSFT will enhance their testing scripts to include Powershell destinations in the future. Additionally, the Anniversary Update also broke InTune on many clients with Windows 10. Fix for that is supposed to be delivered tomorrow. Fingers crossed. Thanks again.

  7. danielj84 says:

    Thank you for this info!

    I’m running Windows 10 AU and my scripts I’m running monthly against our Exchange stopped working and Google redirected me here. I found this code useful (kindly stolen from http://stackoverflow.com/questions/31196825/how-can-i-change-the-version-of-powershell-im-running-in-from-within-the-script) to force a script run in version 2.0 and now my scripts are running again:

    if ($PSVersionTable.PSVersion -gt [Version]”2.0″) {
    powershell -Version 2 -File $MyInvocation.MyCommand.Definition

    ‘run some code’
    Read-Host -Prompt “Scripts Completed : Press any key to exit”

    Thanks once again.

    1. Quick note – added an update to state that a fix is available for download.


  8. Dheeraj says:

    after installing KB3176938
    yes that worked on windows 10 …thanks guys

    1. You can also install the additional update/fix that is listed above


Comments are closed.

Skip to main content