July 7, 2015

// // Leave a Comment

PowerShell Error: Cannot access the local farm

In new environments running the SharePoint PowerShell Scripts the following error can occur if the user does not have the permission to access the SharePoint Config DataBase

To Resolve the below error

Get-SPSite : 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.
At *.ps1:28 char:9
+ $Site = Get-SPSite $SiteUrl
+         ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletGetSite:SPCmdletGetSite) [Get-SPSite], SPCmdletException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite


1) Open the SharePoint PowerShell as Administrator
2) Run the below code in the Shell

Get-SPDatabase | Add-SPShellAdmin SomeDomain\SomeUserName
 3) Log off and login again , This will resolve the issue.


Post a Comment