Monday, September 18, 2017

PowerShell Error :- The local farm is not accessible.

Hi All,

I got a task to read all the users from SharePoint 2010 site. I used PowerShell Script to load the SharePoint DLLs and PowerShell script to read all the user profile information.

But, unfortunately the I got the below error.

I did some research and got to know that I don't have access to Shell Admin. It needs to be done explicitly. You can do it by yourself if you have Farm admin access.
SharePoint creates a shell admin security role in the database which is configurable through powershell
that's all that there is to it, you only need security admin to assign it
you never need database owner for any SharePoint work.

I used the below PowerShell script to add myself to Shell Admin.
$db = Get-SPDatabase | Where {$_.Name -eq “SharePoint_ConfigDB”}
Add-SPShellAdmin “domain\user_to_add” -database $db  

After the script got executed, I could able to run the PowerShell script to load user profile information.

The below link can help you with more information.


Thanks,
Kunal


No comments:

Post a Comment