Written by Tamer Maher El-Sharkawy, Premier Field Engineer
When you launch a SharePoint 2010 Management Shell you might receive one or both of the following errors:
- “Microsoft SharePoint is not supported with version 4.0.30319 of the Microsoft .Net runtime”
- “The local farm is not accessible. cmdlets with feature dependency are not registered.”
This could happen because the PowerShell version used by the shell isn’t the correct one.
At the command prompt run the following commands:
PS C:\ > $ver=$host | select version
PS C:\ > $ver.Version
Major Minor Build Revision
—– —– —– ——–
3 0 -1 -1
If the version indicated is not “2”, the shell is indeed trying to execute with an unsupported runtime, and you get the error above.
First, try Import System Modules as shown:
If that does not resolve the issue, you can navigate to the Sharepoint Management Shell shortcut properties then add “-version 2” to the string in the Target field. Example:
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe –version 2 -NoExit” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ “
Tamer Maher, MCP, MCTS, MCITP