none
The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered

    Question

  • Hi,

    I have my sharepoint devlopment environment and recently install some security updates of Windows Server 2008 R2. When i try to run SharePoint Shell Command i get the error: "The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered". I dont have any PowerGUI software.

    This is what you found in SharePoint Logs:

    • 12/18/2012 09:10:44.47 PowerShell.exe (0x082C) 0x2298 SharePoint Foundation Topology d04h Monitorable Microsoft SharePoint is not supported with version 4.0.30319.586 of the Microsoft .Net Runtime. 02116a40-f800-0000-94f1-e9a81addcd01
    • 12/18/2012 09:10:44.47 PowerShell.exe (0x082C) 0x2298 SharePoint Foundation Topology f2xj Unexpected A PlatformNotSupportedException occured 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) 02116a40-f800-0000-94f1-e9a81addcd01
    • 12/18/2012 09:10:44.47 PowerShell.exe (0x082C) 0x2298 SharePoint Foundation Topology cjl5 Medium An error occured while initializing SPWebService.ContentService. 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)     at Microsoft.SharePoint.Administration.SPWebService.get_ContentService() 02116a40-f800-0000-94f1-e9a81addcd01
    • 12/18/2012 09:10:44.48 PowerShell.exe (0x082C) 0x2298 SharePoint Foundation PowerShell 6tez Medium The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered. 02116a40-f800-0000-94f1-e9a81addcd01

    • Edited by elalinde Tuesday, December 18, 2012 2:35 PM
    Tuesday, December 18, 2012 2:34 PM

Answers

  • Sounds like you may have installed the Windows Management Framework 3.0 which comes with PowerShell 3.0.  I'd suggest uninstalling that from Programs and Features.  Adding the '-v 2' switch will not resolve all issues introduced by installing PS 3.0 on a SharePoint Server.

    .NET 4.0 can stay on the SharePoint Server.

    SharePoint - Nauplius Applications
    Microsoft SharePoint Server MVP
    MCITP: SharePoint Administrator 2010

    • Proposed as answer by ieDaddy Tuesday, December 18, 2012 6:01 PM
    • Marked as answer by elalinde Tuesday, December 18, 2012 10:37 PM
    Tuesday, December 18, 2012 5:35 PM
    Moderator

All replies

  • It's not a function of PowerGUI, it's a problem with having installed .NET 4.0 on your server, which comes with PowerShell 3.0 (despite still being in the v1.0 directory)

    it seems there are several workarounds...

    1. remove .net 4.0 framework, sharepoint is built with 3.5 so it's an option, but not a very good one.

    2. Update to something later than i believe the June 2012 CU.

    3. I ended up just changeing my shortcuts and adding the "-v 2" after the executable in my shortcuts, for example on the shortcut for the sharepoint management shell it now looks like this:

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

    It's not a great workaround, but gets you back to where you need to be.


    ieDaddy
    Blog: http://iedaddy.com
    Twit: @iedaddy

    Tuesday, December 18, 2012 3:36 PM
  • Sounds like you may have installed the Windows Management Framework 3.0 which comes with PowerShell 3.0.  I'd suggest uninstalling that from Programs and Features.  Adding the '-v 2' switch will not resolve all issues introduced by installing PS 3.0 on a SharePoint Server.

    .NET 4.0 can stay on the SharePoint Server.

    SharePoint - Nauplius Applications
    Microsoft SharePoint Server MVP
    MCITP: SharePoint Administrator 2010

    • Proposed as answer by ieDaddy Tuesday, December 18, 2012 6:01 PM
    • Marked as answer by elalinde Tuesday, December 18, 2012 10:37 PM
    Tuesday, December 18, 2012 5:35 PM
    Moderator
  • Trevor got it... went to Installed Updates and searched for KB2506143, uninstalled the little bugger and PowerShell (Get-Host).version is back to 2.0

    Love the disclaimer...or lack of it, but i did find this a bit amusing from: http://connect.microsoft.com/PowerShell/feedback/details/746908/powershell-3-0-and-sharepoint-2010

    Posted by Microsoft on 6/7/2012 at 12:34 PM                                       
                                                This is not an issue with Windows PowerShell. This is an issue with SharePoint 2010. The SharePoint team is aware of this compatibility issue and plans to address it in an upcoming release or service pack.

    ieDaddy
    Blog: http://iedaddy.com
    Twit: @iedaddy

    Tuesday, December 18, 2012 6:01 PM
  • I am having the same issue, I followed the -v2 recommendation and this is the message I get when launching Powershell with the "run as administrator" option:

    Add-PsSnapin : Incorrect Windows PowerShell version 3.0. Windows PowerShell ver
    sion 2.0 is supported in the current console.
    At C:\program files\common Files\microsoft shared\Web server extensions\14\conf
    ig\powershell\registration\sharepoint.ps1:3 char:13
    + Add-PsSnapin <<<<  Microsoft.SharePoint.PowerShell
        + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.PowerShel
       l:String) [Add-PSSnapin], PSArgumentException
        + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
       dPSSnapinCommand

    I do not see the Powershell snapin so I run the command below and I get a similar message as above.

    PS H:\> add-pssnapin Microsoft.SharePoint.Powershell
    add-pssnapin : Incorrect Windows PowerShell version 3.0. Windows PowerShell ver
    sion 2.0 is supported in the current console.
    At line:1 char:13
    + add-pssnapin <<<<  Microsoft.SharePoint.Powershell
        + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.Powershel
       l:String) [Add-PSSnapin], PSArgumentException
        + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
       dPSSnapinCommand

    My issue is that my developers are down as they related on the Management Shell completely.  Uninstalling .NET 4 causes Powershell to fail to launch completely.

    Any tips are greatly appreciated.

    thanks,

    Tuesday, December 18, 2012 6:05 PM
  • Uninstall the Windows Management Framework 3.0/PowerShell 3.0 and your devs should be right back up and running.

    SharePoint - Nauplius Applications
    Microsoft SharePoint Server MVP
    MCITP: SharePoint Administrator 2010

    • Proposed as answer by ErickF-2 Wednesday, December 19, 2012 6:21 PM
    Tuesday, December 18, 2012 6:06 PM
    Moderator
  • I just did so but can't verify until the server is rebooted tonight.  Thank you,
    Tuesday, December 18, 2012 7:35 PM
  • without a reboot you should stil be able to open powershell as v2, just did the KB uninstall and as I am in same boat with not being able to reboot until tonight, but it appears that I've got the SharePoint Mamagement shell openning just fine... not sure I want to know what little pieces are left for the reboot to fix...

    ieDaddy
    Blog: http://iedaddy.com
    Twit: @iedaddy

    Tuesday, December 18, 2012 7:39 PM
  • Even after the uninstall of the KB and the reboot I am still getting the error and the SharePoint snapin is not loading, I verified that the version of Powershell running is version 2, see below:

    Add-PSSnapin : Incorrect Windows PowerShell version 3.0. Windows PowerShell ver
    sion 2.0 is supported in the current console.
    At C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONF
    IG\POWERSHELL\Registration\SharePoint.ps1:3 char:13
    + Add-PsSnapin <<<<  Microsoft.SharePoint.PowerShell
        + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.PowerShel
       l:String) [Add-PSSnapin], PSArgumentException
        + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
       dPSSnapinCommand

    PS H:\> (get-host).version

    Major  Minor  Build  Revision
    -----  -----  -----  --------
    2      0      -1     -1

    Wednesday, December 19, 2012 5:54 AM
  • Can you run the standard PowerShell shortcut as admin and type:

    Add-PSSnapin Microsoft.SharePoint.PowerShell


    SharePoint - Nauplius Applications
    Microsoft SharePoint Server MVP
    MCITP: SharePoint Administrator 2010

    Wednesday, December 19, 2012 5:57 AM
    Moderator
  • Hi Trevor,

    I get the same message when adding the snapin to the standard Powershell console as admin.  I double-checked that it still shows 2.0 as the version.

    I have other issues going on here it seems.

    Wednesday, December 19, 2012 5:50 PM
  • Somehow it looks like you still have PS 3.0 around.  Not sure where to point you if you've validated that PS 3.0/WMF 3.0 have been uninstalled.

    SharePoint - Nauplius Applications
    Microsoft SharePoint Server MVP
    MCITP: SharePoint Administrator 2010

    Wednesday, December 19, 2012 6:08 PM
    Moderator
  • thank you very much, I appreciate all the responses.  I might have to ask management to dust off the credit card to call Microsoft.

    Thank you guys,

    Wednesday, December 19, 2012 6:21 PM
  • By the way, I have another box where the removal of KB2506143 solved the issue so more evidence that i have other problems in my second box.

    thanks again,

    Wednesday, December 19, 2012 6:27 PM
  • I am happy to say that the issue was resolved.  PS3.0 was removed from the box but the compatibility level was still set to version 3, since SharePoint commands are compatible with version 2 but not version 3, Powershell itself was not allowing the snapin to load.

    The following registry location determines the level of PS compatibility, it should be 1.0, in my case it had 3.0.

    HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.SharePoint.PowerShell\PowerShellVersion

    Wednesday, December 19, 2012 11:49 PM
  • Instructions to uninstall Windows Management Framework 3.0 can be found here: http://www.microsoft.com/en-us/download/details.aspx?id=34595#instructions. Look in the sub-heading... To uninstall Windows Management Framework 3.0:
    Thursday, December 27, 2012 10:50 PM
  • Hard to credit that this issue still exists in SP2013. After adding the -v 2 hack I now receive the following.

    Lovely.

    Add-PsSnapin : Cannot load Windows PowerShell snap-in Microsoft.SharePoint.Powe
    rShell because of the following error: Could not load file or assembly 'file://
    /C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.SharePoint.PowerShell\v4.
    0_15.0.0.0__71E9BCE111E9429C\Microsoft.SharePoint.PowerShell.dll' or one of its
     dependencies. This assembly is built by a runtime newer than the currently loa
    ded runtime and cannot be loaded.
    At C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONF
    IG\POWERSHELL\Registration\SharePoint.ps1:3 char:13
    + Add-PsSnapin <<<<  Microsoft.SharePoint.PowerShell
        + CategoryInfo          : InvalidArgument: (Microsoft.SharePoint.PowerShel
       l:String) [Add-PSSnapin], PSSnapInException
        + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
       dPSSnapinCommand

    So I created a powershell.exe.config file and saved it to the PS home directory (\Windows\System32\WindowsPowerShell\v1.0). Don't ask me why, but on native 64-bit systems, the 32-bit version is still used.

    <configuration>
        <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0.30319"/>
            <supportedRuntime version="v2.0.50727"/>
        </startup>
    </configuration>

    Terrific! Try to add the SharePoint Powerhsell Snap-In again and now receive this:

    The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.

    Hmmm.... I ran off the usual check-list:

    • I'm a local admin and farm admin.
    • I ran the shortcut as Administrator.
    • I modified the shortcut to add the (possibly redundnat) -version 2 flag as per SP 2010 fix.

    All to no avail.

    The culprit in this case was a SQL Admin who regularly fails to add the SharePoint farm admins group to the securityadmin and db_owner roles. :\

    Hope this helps someone else.


    If at first you don't succeed, ask an MVP.

    Wednesday, April 10, 2013 12:58 AM
  • So on 2013, SharePoint leverages .NET 4.0 PowerShell -- you would not want to add the '-Version 2.0' switch.  Nor should you need to adjust the powershell.exe.config.

    The Add-SPShellAdmin will automatically grant the necessary rights on all of the databases, given the Farm Admin account has the securityadmin role in SQL (which it should, for other reasons).


    SharePoint - Nauplius Applications
    Microsoft SharePoint Server MVP
    MCITP: SharePoint Administrator 2010

    -----------------------
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Wednesday, April 10, 2013 1:02 AM
    Moderator
  • I have this issue but I do not have Windows Management Framework 3.0 or KB2506143 installed so what is going on?
    Monday, June 17, 2013 1:36 PM
  • In case it helps anyone, another possible cause for this error msg is no credentials to the SQL Server in the SharePoint farm. That was the case for me. Once I added my Windows domain account to the SQL Server as sysadmin then the error msg from the OP was resolved.

    But that begs the follow on question, why isn't my farm configured so adding my Windows domain account to the usual AD groups makes everything right? Time to check with the IT Ops guys.

    Saturday, September 14, 2013 12:18 PM