30

This morning all the development machines at the company I work at, couldn't manage SharePoint through Powershell. We were all getting the annoying "The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered." error.

A quick search has given me two causes for this error.

1: Wrong rights set for the user on the Config DB in SQL

2: Not running the Management Shell as Administrator

Neither of these two are the problem, since nothing has changed.

  • 1
    For me it turned out to be insufficient permissions on the configuration database in SQL. – TempaC Mar 27 '13 at 9:12
31

Turns out the problem was caused by our wonderful operations guys ok'ing a windows update on our development machines.

The update in question is: Windows Management Framework 3.0 for Windows 7 SP1 and Windows Server 2008 R2 SP1

This update updates Powershell to a new version that uses .NET 4.xx and is not compatible with SharePoint 2010 resulting in the error described in the question.

There are two possible solutions.

  1. Add "-version 2" without the quotes to your Management shell link, to force running as an older version.
  2. Remove the update if you have no use for it, for other purposes.

So if you sudenly get this error on a server that has been running fine, check your Windows Updates.

  • Very interesting answer, because I was recently very tempted to move to PowerShell 3. i'll wait for my 2010 boxes :) – Steve B Dec 13 '12 at 15:13
  • 1
    Nice find! Good to know, will test PS3 on another machine... – SPArchaeologist Dec 13 '12 at 15:29
  • 1
    I love our operations guys... They flagged the update as important, so now the evil thing is back.. I love when stuff like this is handled by policy. – Rasmus Dec 14 '12 at 7:33
4

In followup to @JoeJohnston answer crediting me: If you want to play by the rules you won't go modifying permissions on the SQL Server directly. Here is an alternate approach that may work for you, provide you already have one account that can use PowerShell to connect to the SharePoint farm. I haven't had occasion to try it directly.

From SharePoint TechNet article Add-SPShellAdmin

Use the Add-SPShellAdmin cmdlet to add a user to the SharePoint_Shell_Access role as follows:

  • If you specify only the user, the user is added to the role for the farm configuration database.
  • If you use the database parameter, the user is added to the role on the farm configuration database, the Central Administration content database, and the specified database. Using the database parameter is the preferred method because most of the administrative operations require access to the Central Administration content database.

With an example

Add-SPShellAdmin -UserName CONTOSO\User1 -database 4251d855-3c15-4501-8dd1-98f960359fa6

3

In my case the source of this exact error msg was that my Windows domain account was not granted rights to the SQL Server in the SharePoint farm. Once I used SSMS to add my account to the sysadmin role then the SP2010 management shell opened fine without this error. You may want to add this as an alternate stop-gap resolution.

Of course that begs the follow on question, why isn't my farm configured so adding my domain account to the usual AD groups makes everything right?

Credit John Calvert from a blog

2

I updated target in my run command to look like this:

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

2

I recently faced this issue, fixed in SharePoint 2010 management shell shortcut but when I ran my .bat file to deploy solution I still got to see the same error. Checked .bat file and found this line, powershell -noexit -file "xyz.ps1" "%CD%"

So I changed it to following and it worked like charm, powershell -version 2.0 -noexit -file "xyz.ps1" "%CD%"

1

I came across this issue too today, here is the solution - http://blogs.technet.com/b/meamcs/archive/2013/02/18/sharepoint-powershell-command-problem-featuredependencyid-are-not-registered.aspx

You can alternatively open the SharePoint Management Shell as a user that does have Shell access to the SharePoint config DB and then run the command Add-SPShellAdmin DOMAIN\Username of the user that needs shell access.

0

If the issue is not related to the SQL permission, so you should update the SharePoint Shell target with the correct version as below:

For SharePoint 2016

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 3
-NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "

For more details, check The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered in SharePoint

  • Although this explains the fix the OP applied in detail, it does not explain why it works. For that, see the accepted answer, where the OP explains that upgrading PowerShell caused the original issue. – jpaugh Jul 5 at 17:21
  • @jpaugh the details explained in the mentioned link, I posted this answer for SP 2016 that using V3 not V2 as provided in the accepted answer!! Check first, before judge!! – Mohamed El-Qassas MVP Jul 5 at 18:26

protected by Mohamed El-Qassas MVP May 14 at 14:20

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.