1

Am getting error when I tried to access the SPSite object in ISE Window:

My environment version : SP 15.0.4569.1506 Installed

   add-pssnapin "MICROSOFT.SHAREPOINT.POWERSHELL"
   $msite=  get-spsite "http://sharepointapp100:1234/sites/Demo"
   $msite
   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 line:6 char:10
   + $msite=  get-spsite "http://sharepointapp100:1234/sites/Demo"
   +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletGetSite:SPCmdletGetSite) [Get-SPSite], SPCmdletException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite

While installing SP,I did not configure SQL server separately, its assumed that, SP has SQL Express by default.

Please correct me, whether I have done anything wrong like, I have to install SQL 2012 ENT.Edition before installing SP 2013.

When I installed VS 2013 on this machine and tried to connect to a site, it shows error.And I am unable to create a SPSITE object in the .ascx.cs file. though the visual web part has all the SP references.

2

This is a common type of error normally shown while executing some PowerShell command. The main reason for this type of error is: The account which your are using to run this command doesn't have full permission to run the Powershell command.

Try to run this PowerShell command with an account who have the full permission at farm level or the account who have farm admin access rights.

  • 1
    The account which I used belongs to farm admin group and machine admin group.and in sql, it has sysadmin & dbcreator privileges.Anything else should I add ? – SaMolPP Nov 27 '15 at 11:14
  • 1
    Maybe Add-SPShellAdmin is here the key? technet.microsoft.com/en-us/library/ff607596.aspx – Patrick Nov 27 '15 at 11:26
0

If you're executing these commands remotely, it's possible that you're running into the infamous Double Hop problem in PowerShell:

I am on ServerA, connected to ServerB where I need to reach ServerC. I have permissions to ServerC, but I still get Access Denied. Default Kerberos rules prevent ServerB from passing credentials to ServerC.

...

For example, from your workstation you connect to your SharePoint server with PowerShell remoting. The SharePoint cmdlets need to access a backend SQL server, but they fail.

A previous blog post by the same author suggests the following solution:

Kerberos double hop for PowerShell remoting can now be solved with one simple cmdlet:

$ServerB = Get-ADComputer -Identity ServerB            
$ServerC = Get-ADComputer -Identity ServerC            
Set-ADComputer -Identity $ServerC -PrincipalsAllowedToDelegateToAccount $ServerB
# Then on ServerB: KLIST PURGE -LI 0x3e7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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