SharePoint 2010 Management Shell - .Net 4.0 runtime version error
Written by Tamer Maher El-Sharkawy, Premier Field Engineer
Issue:
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.
Diagnostics:
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.
Workaround:
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
Comments
Anonymous
January 01, 2003
Very good content.Anonymous
November 21, 2012
I am trying to find the "Import System Modules" is that something that I should download / have?Anonymous
December 12, 2012
The example shortcut above does not work. The -Version 2 needs to be before -NoExit. Working shortcut is. C:WindowsSystem32WindowsPowerShellv1.0PowerShell.exe -Version 2 -NoExit " & ' C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14CONFIGPOWERSHELLRegistration\sharepoint.ps1 ' "Anonymous
December 13, 2012
Thank you Kent. This syntax fixed my problem. I am still not sure why it broke all the sudden. I have been using sharePoint 2010 Management Shell several months without a problem. All of the sudden it stopped working. Wonder if it was due to updates. Anyway, all fixed.Anonymous
February 28, 2013
Does NOT work for many processes that automatically use PowerShell like a scheduled task or PowerPivot with SSRS.Anonymous
March 20, 2013
I am actually getting an error launching the SharePoint Management Shell for SP2013 on a Windows Server 2012. select : The term 'Select-Object' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15CONFIGPOWERSHELLRegistrationSharePoint.ps1:1 char:16
- $ver = $host | select version
- ~~~~~~ + CategoryInfo : ObjectNotFound: (Select-Object:String) [], Comma ndNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Any ideas? Thanks in advanced!
Anonymous
June 13, 2013
I tried this and the powershell starts then exitsAnonymous
July 26, 2013
thanks, man!!!Anonymous
July 30, 2013
Thanks a lotAnonymous
August 26, 2013
@Lou - did you find a solution for Select issue ?Anonymous
August 29, 2013
The comment has been removedAnonymous
February 23, 2015
Information was good, I like your post.
Looking forward for more on this topic.
http://staygreenacademy.com">SharePoint Online trainingAnonymous
February 23, 2015
I absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for.
http://khalil-kothia.com">SharePoint consultingAnonymous
September 29, 2017
Thanks ))Anonymous
December 11, 2017
The comment has been removed