SharePoint Management Shell (PowerShell) stops working after Windows Update installs Windows Management Framework 3.0

I recently logged into a SharePoint 2010 App Server (Server 2008 R2 SP1) and started SharePoint Management Shell. I was greeted with the familiar “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered”, and were also unable to execute any SharePoint PowerShell commands. The ventured reader will recognize this error, it’s the one that is displayed when the logged in account does not have permissions. The fix for that is quite easy, add the user as Shell Admin using Add-SPShellAdmin (using an account with appropriate permissions, of course).

In this case, however, this did not make any sense. I had previously used the SharePoint 2010 Management Shell on this server and, just to confirm, one of the local IT Administrator were also granted this warning message and were unable to run any SharePoint PowerShell commands.

Further investigation showed that the server had been patched using Windows Update earlier the same day. One of the updates that had been installed was KB5206143, Windows Management Framework 3.0 for Windows 7 SP1 and Windows Server 2008 R2 SP1, which among other features installs PowerShell 3.0. The update was published (published 11. Nov. 2012), As you might know, SharePoint 2010 does not like PowerShell 3.0 very much, yet… This is actually an issue even in Server 2012.

A bug has been raised for PowerShell 3.0, but closed by Microsoft with the message: image

Perhaps a fix is coming in a cumulative update soon? Until then, the workaround is quite simple: Start PowerShell with the parameter “-Version 2.0” or just “-v 2” and then add the SharePoint Snap-In using “Add-PSSnapIn Microsoft.SharePoint.PowerShell”.

I haven’t tried to uninstall the Windows Management Framework 3.0, but I don’t see why that wouldn’t work as well.

If Google brought you here, I hope I have been of help.