Posts

Showing posts from September, 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

SharePoint 2010 - The site is not valid. The 'Pages' document library is missing

Issue:

If you're encountering the following error, via ULS, or the event log, due to a page library,

This site is not valid. The 'Pages' document library is missing.

The issue can be remedied with a quick powershell script.

Workaround:

Perform the following script on the page library causing the issue, and it will remove the error.
$web = get-spweb http://somesite/somesubsite $pageId = $web.Lists["Pages"].ID $web.AllProperties["__PagesListId"] = $pageId.ToString() $web.Update()