Home > SharePoint 2010, SharePoint Administration > Fixing: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered when trying to run SharePoint 2010 PowerShell

Fixing: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered when trying to run SharePoint 2010 PowerShell

Recently I ran into this problem on my SharePoint 2010 farm which prevented me from running any PowerShell scripts or Cmdlets using the SharePoint 2010 Management Shell.  It was working fine before, but then recently when I would try to bring up the Management Shell with admin rights/farm admin rights I keep getting this error:

“The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered when trying to run SharePoint 2010 PowerShell”

Now this message would initially come up when you first build out your SharePoint 2010 farm, but since my farm has been configured and running for over a year now I was little concerned.

This message would also show up if you try to run the SharePoint 2010 Managment Shell without the proper permissions, or if the account does not have the proper permissions in SQL.

However, in my case I knew that the account had the proper permissions to run the Managment Shell, and also the proper permissions within SQL.

If both are also true for you, and you still receive this error, then try this for the fix.

Apparently (for unknown reasons) still looking into the cause, the SharePoint 2010 Management Shell was pointing to the incorrect version or path that is invalid and not compatible.

To Verify which version is being used

1.  Bring up SharePoint 2010 Managment Shell (ignore) the error Message
2.  Type:

$ver=$host | select version
$ver.Version

3.  If you receive something like below.  If the Major version is not on 2, then you will get this runtime error.

Major  Minor  Build  Revision
—–  —–  —–  ——–
3      0      -1     -1

4.  Close out of SharePoint 2010 Managment Shell.
5.  Go back to the SharePoint 2010 Managment Shell Shortcut, right click and select “Properties”
6.  Under the Shortcut tab, Target: section, insert “-version 2” into the path, like so.  Make sure its before the -NoExit.

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 ‘ ”

7.  Click apply, and then Ok
8.  Reopen up the SharePoint 2010 Managment Shell with admin rights, and you should now no longer receive that error, you should then be able to run your scripts.

Again not sure why this happened, or what caused it.  I will look more into the reasoning.  However, hopefully this helps others that are having a similar issue.

Advertisements
  1. AlexK
    March 27, 2013 at 12:19 am

    What if Major version is already on 2 and you are still getting the error?

    • March 27, 2013 at 7:20 pm

      Hi AlexK,

      I’m assuming you are logged into your server with local admin/farm admin rights, and you are opening up SharePoint Management Shell with elevated privileges?

      If you run this command:

      Get-SPShellAdmin

      What does it return? Do you see the account you are using listed?

      • Achiles Camilo
        July 4, 2013 at 2:18 pm

        Jshidell, I have the same problem and I’m with the right privileges. I already checked the SQL permissions and I’m using the Farm Administrator account.

        I’ve tried to run the “Get-SPShellAdmin” cmdlet and I received this message:

        Get-SPShellAdmin : Object reference not set to an instance of an object.
        At line:1 char:17
        + Get-SPShellAdmin <<<<
        + CategoryInfo : InvalidData: (Microsoft.Share…GetSPShellAdmin:
        SPCmdletGetSPShellAdmin) [Get-SPShellAdmin], NullReferenceException
        + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSPShe
        llAdmin

      • July 8, 2013 at 11:00 am

        Hi Achiles,

        You did make sure that the version you are on is 2 correct?

        Do you have multiple SharePoint WFEs?

        Thanks

  2. Clement2003
    May 21, 2013 at 2:53 pm

    This fixed my pb

  1. January 29, 2013 at 4:39 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: