Thursday, September 27, 2012

SharePoint 2010 - Cannot access the local farm.

Issue:

If you're encountering the following error, when trying to run a powershell script, you may not have sufficient permissions on the database.

Get-SPWeb : Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permission to access the database before trying again.

The issue can be remedied with a few quick powershell commands.

Workaround:

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
Post a Comment