SharePoint 2010: Cmdlets with FeatureDependencyId are not registered
Case
All of sudden my PowerShell stopped working with the following error
“The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered”
http://2.bp.blogspot.com/-IKsAdGv54T0/UwIX94l_GWI/AAAAAAAAA68/hwn9RVZLZjM/s1600/01.png
I am currently with SharePoint 2010 on my development machine on Windows 7 with SqP1. After having SharePoint installed for a couple of days PowerShell was working absolutely fine but now when I need to do something with scripting it has stopped working.
Steps
Tried two things very quick but still no luck:
- I have already tried to run PowerShell as an Administrator
- I have already given SharePoint_Shell_Access permission to the farm account on SharePoint Config. and Admin Content both databases.
As a next step I investigated the current version of PowerShell, I started PowerShell window and just ran the command:
$psversiontable
http://4.bp.blogspot.com/-1rMc9vnQ41g/UwIX9zJVsSI/AAAAAAAAA64/HPD93TwEX7k/s1600/02.png
I found following:
http://4.bp.blogspot.com/-1rMc9vnQ41g/UwIX9zJVsSI/AAAAAAAAA64/HPD93TwEX7k/s1600/02.png
As you can see it is PowerShell Version 3.0 which doesn’t support SharePoint 2010 http://blogs.msdn.com/b/ronalg/archive/2013/07/29/10382902.aspx?CommentPosted=true#commentmessage
Now how come it is upgraded to PowerShell 3.0?
I found that on my system there was a windows update installed as shown below. This upgrade has installed Windows Management Framework 3.0. WMF 3.0 also includes PowerShell 3.0, you can see on this link http://www.microsoft.com/en-us/download/details.aspx?id=34595
http://3.bp.blogspot.com/-yRl4qYp0-ig/UwIVu-lRAxI/AAAAAAAAA6s/u_nqcsVmM2c/s1600/03.png
Solution
To resolve the issue quick: I changed PowerShell start menu short cut path and added –version 2.0 switch parameter, below is the complete path with –version 2.0 switch.
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' "
Add –version 2.0 switch;
By doing this I could run PowerShell 2.0 which support SharePoint 2010 commands
References
http://spshare.blogspot.in/2014/02/powershell-30-issue-with-sharepoint-2010.html