Microsoft SharePoint 2010 is not supported with version 4.0+ of the Microsoft .NET Framework. This issue can come into play if you happen to install the Windows Management Framework 3.0+, .NET Framework 4.0+, or PowerShell v3.0. All of these items run on a CLR (Common Language Runtime) of 4.0+, the default that comes with these applications. When loading the SharePoint 2010 Management Shell, you may see one of the following:
The local farm is not accessible. Cmdlets with FeatureDependencyID are not registered
Microsoft SharePoint is not supported with version 4.0.x
To address this, there are a couple of workarounds:
Force the SharePoint Management Shell to use PowerShell Version 2
Forcing the shell to run on PSv2 is a quick workaround that requires no downtime, restarts, or interruptions in services.
- Right click the icon for the SharePoint Management Shell, click Properties
- Click the shortcut tab in the properties window
- Input the following into the target value:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 2.0 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "
This will force the Shell to open in PowerShell v2.0, running the CLR 2.0.X. To verify this, open the SharePoint Management Shell, and type $psversiontable. This will show you the version of CLR and PowerShell that the current session is utilizing.
Force PowerShell to globally use a different CLR
- Create or edit a file at $pshome\powershell.exe.config
- Insert or edit the contents to include the line for the CLR 2.0.X support, ensuring that this is before the 4.0 callout (the order of the supported run times shows how the system will favor each).
- Save the file and reopen any previous PowerShell sessions
- Test this by opening PowerShell and running the $psversiontable command