1

I am trying to use PowerShell ISE on my local client to access my SharePoint Farm. I am getting the error: "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."

I have given my account admin permissions in the: WSS_Admin_WPG on the SP Servers SharePoint_Shell_Access role on database Security_Admin role on the SQL instance db_owner role on the database (in fact I gave myself db_owner and SP_Data_Access on all of them at one point) I am also local admin on all the SharePoint servers

What am I missing?

1
  • I was talking to one of my former colleagues who has attempted a Windows server to SQL server from a client PC and he said it involves one more step. The server PC machine name also needs permissions on the SQL server machine as well as the necessary databases. So, the double hop needs both the user account and all computers involved in the permissions exchange.
    – Justin
    Feb 18, 2017 at 23:22

3 Answers 3

1

When running PowerShell ISE, you need to Add-PSSnapin to Microsoft.SharePoint.PowerShell

if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"} 
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{
     Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

Run this script and try again.

And as always, you have to be on the server when running scripts!

7
  • Thank you. I should have mentioned I can run the Add-PSSnapin successfully.
    – Justin
    Jan 25, 2017 at 14:50
  • @Justin Great! If that helped you - you can accept this answer which will help others with the same problem. :)
    – Benny Skogberg
    Jan 25, 2017 at 15:52
  • I wish that was all. At that point when I try to "Get-" anything from the farm, I get the error I posted.
    – Justin
    Jan 25, 2017 at 16:01
  • @Justin You have to be on the server!
    – Benny Skogberg
    Jan 25, 2017 at 16:20
  • 1
    Benny is correct, you need to run the script on the server where SharePoint is installed. Jan 25, 2017 at 17:41
0

You can't use the server object model from your client. You need to use the client object model. You can only load the snap-in on the server itself.

Download the client SDK from here: https://www.microsoft.com/en-gb/download/details.aspx?id=35585

0

Go to Start >> Type “PowerShell ISE”. Right, Click and Open PowerShell ISE with “Run as Administrator” if you have UAC enabled. Now, You can start writing your PowerShell script or copy-paste the script and then click on the “Run Script” button from the toolbar.

Hope You Find This Useful, Peter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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