Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Yes, I am logged into the machine as an administrator, and my domain account id a farm admin as well. The site is running properly, and nothing seems wrong in SP Central Administration. But when I start powershell, I get "Cannot access the local farm"

Also, running powershell with admin rights.

Where do I start to diagnose this issue?

Cheers, Daniel

share|improve this question

6 Answers 6

up vote 20 down vote accepted

Found it. My account needed proper rights in Sql Server, per this post:

It worked once I set "Sharepoint_Shell_Access" to the Sharepoint_Config database.

What got me here was searching for the first message: "the local farm is not accessible"

share|improve this answer
You should mark your own answer (with the check mark) – Gabriel Mongeon Jun 8 '11 at 20:43
ah, would do so, but need to wait 2 days for some reason. odd – Daniel Williams Jun 8 '11 at 21:33
this is so people dont just boost their rep answering their own questions :-) – Anders Rask Jun 9 '11 at 12:56
Also remember UAC can be an issue here. Check my blog post on that issue… – Anders Rask Jun 9 '11 at 12:57

Perform the following script in the SharePoint Management Shell, as a farm administrator and it will remove the error.

Get-SPDatabase | Add-SPShellAdmin SomeDomain\SomeUserName

This will grant the user both access to the configuration database as well as the content database.

Alternatively, you can revoke that granted access with the opposite command.

Get-SPDatabase | Remove-SPShellAdmin SomeDomain\SomeUserName
share|improve this answer
Quin Johns - It worked like a charm - Thanks :) – user14861 Feb 13 '13 at 7:08

I know you are a farm admin, but try right clicking on Powershell, and select 'Run as Administrator'

share|improve this answer
Vote up for this. Also, the user may need to be in the local WSS_Admin_WPG group. – Underverse 21 hours ago

It is possible that your PowerShell version is incompatible with the SharePoint Management Shell (commandlets).

Use below command to change the version used:

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' "

Add –version 2.0 switch;

share|improve this answer

I had the same issue.

The local farm is not accessible

But after restart and repeating Add-PSSnapin Microsoft.SharePoint.Powershell it worked perfectly.

share|improve this answer

Sometimes running as 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. Now you should be able to use Quinn Johns' answer to grant shell access to other accounts.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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