Problem

When you launch the SharePoint 2013 or 2010 Management Shell (in this case SharePoint 2010) :

The following error occurred: "The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered"

Explanation

Even if you have launched the Shell with an account who is in the "Farm administrators" group, you can come across this error.

Why? Because there is a big difference between using your account in the central administration and in PowerShell. When you launch operations in the central administration, the pool account is used, and they have all the required rights on the server and the databases. When you launch commands in PowerShell, your account is used to run the commands, and they must also have the required rights (and in this case, we did not).

Resolution

You can modify manually the rights associated to your account in SQL Server, but instead use the Add-SPShellAdmin cmdlet which will do the work for you.

Launch this cmdlet by using (for example) the account used to install your farm.

Syntax : Add-SPShellAdmin -UserName Domain\User

References

  • To get the list of all the users having the "SharePoint_Shell_Access" role, use the Get-SPShellAdmin cmdlet.
  • To delete a user from the "SharePoint_Shell_Access" role, use the Remove-SPShellAdmin cmdlet.

Other languages

This article is also available in the following languages :