I got “The local farm is not accessible. Cmdlets with Feature Dependency Id are not registered” when I tried to open SharePoint PowerShell.
In this post, we’re gonna fix the below SharePoint Farm Accessibility issue by going though the following:
- 1 SharePoint The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered
You might also like to check PowerShell Script: SharePoint Farm Scan Report.
Applies To
- SharePoint 2019.
- SharePoint 2016.
- SharePoint 2013.
The “local farm is not accessible. Cmdlets with FeatureDependencyId are not registered” issue usually occurs in case of
- The SharePoint Management Shell is not run as Administrator.
- The current user doesn’t have sufficient permission on the SharePoint_Config database.
- A new .Net framework update has been installed that affect the PowerShell version.
- Make sure that, you have run the SharePoint Management Shell as Administrator as shown below.
If the issue still exists that means the current user doesn’t have “SharePoint_Shell_Access” role on the SharePoint_Config database.
Steps
- 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!
Try now to open SharePoint PowerShell, the The local farm is not accessible. Cmdlets with Feature Dependency Id are not registered would be gone!
As an alternative solution, you can use the SharePoint PowerShell to provide a specific user a “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.
- It’s preferred to use the farm account.
- The current user is a member of the local administrator group.
- Add the farm account temporarily to the local administrator group during running this cmdlet then remove it once you finish.
- Note: don’t forget to restart the SharePoint timer service as mentioned at Restart SharePoint Timer Service From Command-Line.
Steps
- Open Windows PowerShell as an administrator.
- Run the below Cmdlets, one by one.
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$database = Get-SPDatabase | Where {$_.Name -eq "SharePoint_Config"}
Add-SPShellAdmin -UserName "Domain\User" -database $database
Don’t forget to provide your user name and the SharePoint configuration database name
In some cases, if the issue “The local farm is not accessible. Cmdlets with Feature Dependency Id are not registered” not fixed that means it is not related to permissions, and maybe the PowerShell has been affected by a new applied update like .Net framework.
In this case, you have two options:
- Remove the newly installed updates.
- Or, run the SharePoint Shell with the old version.
Steps
- 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
-Version 3
before-NoExit
, to looks like- Note: if 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 an 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 as shown below.
Try again, the The local farm is not accessible. Cmdlets with Feature Dependency Id are not registered would be solved and the local farm should be accessible now!
Conclusion
In conclusion, we have solved “SharePoint The local farm is not accessible” in SharePoint PowerShell by providing the sufficient permissions and exploring other workarounds.
You may also like to read
- PowerShell Script: SharePoint Farm Scan Report
- Database running in compatibility range and upgrade recommended in SharePoint.
- Failed to create the SharePoint Configuration Database.
- SharePoint 2016: Cannot access the local farm using PowerShell
Have a Question?
If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.
Awesome, last option solved my issue
Glad to hear it helped you!
Pingback: SharePoint 2016: Convert Server Role to Web Front End With Distributed Cache Role | ITCore