While trying to execute this Power-shell command:

$site = Get-SPSite  "http://mysite/"


Get-SPSite : Cannot find an SPSite object with Id or Url: http://mysite/. At line:1 char:9 + $spSite = Get-SPSite <<<< " + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletGetSite: SPCmdletGetSite) [Get-SPSite], SPCmdletPipeBindException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite

  • Hi Sam, Did you ever find the reason for the error? Thanks
    – Daniel
    Commented Nov 8, 2016 at 19:42

5 Answers 5


Maybe this user doesn't have enough permissions to get spsite. Add him as SPShellAdmin in content database please.

$db = Get-SPContentDatabase -site http://sharepoint 
Add-SPShellAdmin -UserName SPSP_User -database $db

reference blog

  • Get-SPContentDatabase gives the same error. I have manually found the databaseid and assigned it and added the Add-SPShellAdmin to the database. It still gives the same error after adding the user as shelladmin. I do have all requisite permissions on the contentdb.
    – Daniel
    Commented Oct 21, 2016 at 21:12

I had this same issue and a coworker suggested adding the user to the SPDataAccess role in SQL for the content database. This was all it took to resolve.

  • Life saver. For me Get-SPSite was working but Get-SPWeb was not. The account already had spshelladmin and even removing and re-adding spshelladmin didn't help. Adding this role to the user did the trick, thanks. Commented Jan 31, 2018 at 18:10

You have the same error message if the Security Token Service does not function properly. See this blog post for the detailed description.


Run command $site = Get-SPSite -Identity "http://mysite/"


Make sure that you run the SharePoint power-shell command on the same machine(Farm) containing the site, otherwise it will not work.

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.