We have a new SharePoint administrator who joined our team. We granted him access to all SharePoint servers, added him to the Farm Admin group, Web application policy.
However, when he tried launching SharePoint Management Shell or try adding the SharePoint PowerShell snap-in from PowerShell ISE, got the error message:
“The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered”
Solution: Grant Permissions to Run PowerShell Script on SharePoint
Basically, We’ve to grant “Shell Admin” access rights to be able to run PowerShell scripts in SharePoint. As the first step, add the new user to the “Local Administrator” group of the SharePoint WFE/App Servers. Login as with Farm Admin access rights and run:
This cmdlet grants “SharePoint Shell Access” membership rights on the SharePoint Farm configuration database and adds the user under WSS_ADMIN_WPG group in all of SharePoint front-end servers.
While the above cmdlet gives access to the SharePoint Management shell, You have to grant access to all SharePoint databases as well:
Get-SPDatabase | Add-SPShellAdmin Domain\User
The Account in which you are running the above PowerShell cmd-lets should have “DB Creator” and “Security Admin” server roles in SQL Server and Local Administrator of the server from which you’re running the cmdlet. By default, The Farm Admin account is granted these rights during the initial farm setup.
To get the list of all the users having the “SharePoint_Shell_Access” role, use the Get-SPShellAdmin. To delete a user from the “SharePoint_Shell_Access” role, use the Remove-SPShellAdmin .
Last but not least: You may also receive this error when UAC is turned ON. Use “Run as Administrator” on SharePoint Management Shell to overcome “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered” error!
Another case: Have you installed new version of PowerShell?
In an another scenario, We got this issue when the .Net framework and Windows Management framework update is installed. To resolve the issue, Just add “-version 2” to the “SharePoint 2010 Management Shell” link’s target field.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ “
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 ‘ “