When I tried to open SharePoint Management Shell, I got the below error:
The local farm is not accessible. Cmdlets with Feature Dependency Id are not registered
“The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered” Cause:
The “local farm is not accessible” issue usually occurs in case of
- The SharePoint Management Shell is not run as Administrator.
- The current user don’t have sufficient permission on the SharePoint_Config database.
- A new .Net framework update has been installed that affect the Power Shell version.
Run the SharePoint Management Shell as Administrator
- Make sure that, you have ran the SharePoint Management Shell as Administrator as shown below.
Grant SharePoint_Shell_Access Role on SharePoint_Config database
If the issue still exists that means the current user doesn’t have SharePoint_Shell_Access role on the SharePoint_Config database.
- Open SQL Management Studio > Connect to SQL Server.
- From Object Explorer > Security > Logins.
- Right clicks on the current user > Properties.
- If the current user is not found, you would add it.
- From left side > click on the “User Mapping“.
- Check “SharePoint_Config” database > Check SharePoint_Shell_Access role.
- Reopen the SharePoint Management Shell.
- The local farm should be accessible now!
Set SharePoint_Shell_Access Role on SharePoint_Config database using Power-Shell
As an alternative solution, you can use the SharePoint Power Shell to provide a specific user “SharePoint_Shell_Access” role.
This solution is preferred in case,
- You don’t have access to the database server or SQL Server instance.
- Your organization policy prevents to modify the database users Roles.
Also, this solution requires the below permissions:
- The current user is a farm administrator (Use the farm account).
- The current user is a member in local administrator group.
- Open PowerShell as administrator.
- Run the following Cmdlets, one by one.
Add-PSSnapin "Microsoft.SharePoint.PowerShell" Add-SPShellAdmin -UserName Domain\User
Run SharePoint Management Shell with old version
In some cases, the issue is not related to permissions, and may be the Power-Shell has been affected by an applied update.
In this case, you have two options:
- Remove the newly installed update.
- Or, run the SharePoint Shell with old version.
- Get the current SharePoint Management Shell Target.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "
- Add the Version parameter
-NoExit, to looks like
- Note: if the version 3 is not worked, try to use version 2.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 3 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 3 -NoExit " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "
- Run CMD as administrator, then paste the above cmdlet to make sure that it’s working properly.
- If the above cmdlet worked properly, so that, you should update the target with the correct version at.
- SharePoint 2016.
- SharePoint 2013.
- SharePoint 2010.
In this post, I have fixed the “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered” issue.