I'm trying to connect to a Sharepoint Server 2016 and run Sharepoint cmdlets but I am getting an error saying: "Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again". I'm using winrm and connecting from a host that is not a windows machine. When I login to the server directly using the same admin account, my Sharepoint cmdlets work as expected.

It seems this could be related to a "double hop" issue because my SQL server is on a server separate from Sharepoint Server. My servers are azure virtual machines.

I have tried the following and still seeing the error:

  • Using sharepoint server admin account credentials.

  • Adding admin user to user groups WSS_ADMIN_WPG, WSS_RESTRICTED_WPG_V4 and WSS_WPG on sharepoint servers local users.

  • On Sharepoint Server, adding the admin user to shell admins using:

    Get-SPDatabase | Add-SPShellAdmin contoso\admin

  • Ran the following on sharepoint server:

    Get-ADComputer -Identity <sharepoint server> | Set-ADAccountControl ‑TrustedForDelegation $true

  • Added the non-windows hostname I'm connecting from to trusted hosts:

    Set-Item WsMan:\localhost\client\trustedhosts -Value "<hostname>" -Concatenate -Force

  • Added sharepoint server admin account to all roles on SQL Server

Looking for other suggestions that I may have overlooked?

1 Answer 1


Sometimes running as an administrator does not work if the administrator does not have proper database/shell permissions, either. In that case, hold down shift and right-click on the PowerShell icon. Choose to run as a different user and run PowerShell as the farm account.

This May Work, Peter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.