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”

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:

Add-SPShellAdmin DomainUser

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.

grant SharePoint_Shell_Access

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 DomainUser

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:WindowsSystem32WindowsPowerShellv1.0PowerShell.exe  -NoExit  ” & ‘ C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14CONFIGPOWERSHELLRegistration\sharepoint.ps1 ‘ “
C:WindowsSystem32WindowsPowerShellv1.0PowerShell.exe -Version 2.0 -NoExit ” & ‘ C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14CONFIGPOWERSHELLRegistrationsharepoint.ps1 ‘ “

Source link