Microsoft SharePoint is not supported with version 4.0.30319.239 of the Microsoft .Net Runtime

Problem:

You install Windows Management Foundation 3.0 pack and you get the following error when running power shell: Microsoft SharePoint is not supported with version 4.0.30319.239 of the Microsoft .Net Runtime

Solution:

(Thanks to Michelle T from the SBS Diva)

Exchange 2010 SP2 Rollup 5v2 fails to install (KB2785908):
http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/7932aecb-8fa9-4a18-a605-ae6fd1020064

When you start to patch your SBS 2011 box, do NOT install the optional Windows Management Foundation 3.0 pack on the box.  It is not supported to be installed where Exchange 2010 is also installed.

Note – I cannot find this fact documented in the PowerShell 3.0 release notes, but I know this from various web sites/googling my brains out and getting a verbal confirmation from several folks that it won’t be supported on Exchange 2010 until SP3 comes out which is some time next year.

Furthermore there is clearly a known issue with SharePoint 2010:

Known Issues

SharePoint Server 2010 Management Shell Stops Working
After Installing Windows Management Framework 3.0

After installing Windows Management Framework 3.0, the SharePoint Management Shell returns the following error:

“Microsoft SharePoint is not supported with version 4.0.30319.239 of the Microsoft .Net Runtime.”

The SharePoint 2010 Management Shell is not supported on Windows PowerShell 3.0.

To resolve the problem:

  1. Use the following command to start the Windows PowerShell 2.0 engine.

powershell.exe -Version 2.0

  1. Use the following command to add the SharePoint snap-in

Add-PSSnapin Microsoft.SharePoint.PowerShell

…and I get this on my test box:

If you have the update (KB2506146 for Windows 2008 SP2 and KB2506143 for Windows Server 2008 R2 SP1) installed on your server, an optional update KB2823180 will be offered through Windows Update.