Wednesday, May 25, 2016

Exchange Management Shell and PowerShell 5.0

Hi folks,

Recently I have installed Exchange 2016 on my brand new Windows 2012 R2 box . When launching Exchange Management shell (aka PowerShell, aka EMS) I was greeted by error as below:

When trying to launch remote PowerShell session to Exchange I was successful. EAC was also working fine. Therefore it was something local on my server which would prevent me launching EMS locally.

During investigation I discovered this blog post for which I'm extremely thankful to its author.

I have executed $PSVersionTable.PSVersion to discover that PowerShell version that was installed on my server was 5.0.

This was result of having Windows Management Framework update being installed on my server.  According to this TechNet article Windows Management Framework 5.0 which includes PowerShell 5.0 is not supported with Exchange 2013/16. And apparently this is something I have discovered among updates installed on my server.

Uninstall of this update is needed to restore EMS functionality. I have discovered this script from the TechNet gallery to perform WMF uninstall automatically. Basically it is a PowerShell module which needs to be imported into the  PowerShell session. After this you will need to run Uninstall-OSCHotfix cmdlet which will removed WMF 5.0 from your server.

The code will be something like this:

Import-Module D:\Scripts\UninstallHotFixPowerShell\UninstallHotFix.psm1
Uninstall-OSCHotfix -HotFixID KB3134758

After the above commands have been executed you will need to restart your server. After this you can run the following command to confirm that PowerShell version installed on your server is 4:


The try to launch EMS and voila it works: