Problem

You install .NET Framework 4.0 on your SharePoint 2010 WFE and SharePoint 2010 Management Shell stops working. When you run it, you get the following message:

The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

Running any SharePoint cmdlet yields the following result:

Get-SPDatabase : Microsoft SharePoint is not supported with version4.0.30319.296 of the Microsoft .Net Runtime.

Solution

Modify the shortcut used to run SharePoint 2010 Management Shell.

  1. Right click on the shortcut -> Properties
  2. Under the Shortcut tab, modify the Target by adding -version 2.0 just after PowerShell.exe so that if looks like: PowerShell.exe -version 2.0 -NoExit
  3. Save your settings and re-run SharePoint 2010 Management Shell.