Freigeben über


SharePoint 2010 Management Shell does not load with Windows PowerShell 3.0

 

Let’s say that you install PowerShell 3.0 by by installing the Windows Management Framework (WMF) 3.0 from

However, after you install WMF 3.0 and PowerShell, you may receive one or both of the following error messages when you start SharePoint 2010 Management Shell:

  1. The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.
  2. A PlatformNotSupportedException occurred while trying to acquire the local farm: System.PlatformNotSupportedException: Microsoft
    SharePoint is not supported with version 4.0.30319.586 of the Microsoft .Net Runtime.
    at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Farm() at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, Boolean& isJoined)

Cause

.Net 4.5 comes with PowerShell 3.0 which seems to break SharePoint 2010 PowerShell administration. That is because PowerShell 3.0 loads CLR 4.5 and
SharePoint 2010 needs CLR 3.5 (AKA 2.0).

How do you get around it:

  • Type "PowerShell -v 2" (without quotes). This loads PowerShell version 2, and you should be able to use it for SharePoint. Just type 'Exit' to get back to PowerShell v3
  • Add '-version 2.0' parameter when executing PowerShell 3.0, and SharePoint integration should work.
  • Change the Target field value for SharePoint 2010 Management Shell to the following:

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 ' "

See KB 2796733

Note: This is not an issue with Windows PowerShell. This is an issue with the SharePoint 2010 compatibility with PowerShell 3.0.

Comments

  • Anonymous
    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://staygreenacademy.com">SharePoint 2013 Training Online
  • Anonymous
    February 23, 2015
    Information was good, I like your post.
    Looking forward for more on this topic.
    http://khalil-kothia.com">SharePoint consulting