I am running this simple command from powershell under a user context, who has db_owner and SharePoint_shell rights to the SharePoint_config database. I get the following error:

PS C:\Windows\system32> Get-SPWeb <site>
Get-SPWeb : Cannot find an SPWeb object with Id or Url : <site> and site Url <site>.
At line:1 char:10
+ Get-SPWeb <<<<  <site>
    + CategoryInfo          : InvalidData: (Microsoft.Share....SPCmdletGetWeb:
   SPCmdletGetWeb) [Get-SPWeb], SPCmdletPipeBindException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetWeb

Any idea this might be happening? Do I need to run this command under farm administrator account? Also, how do I find out who the farm admin is?

  • 1
    Are you executing Get-SPWeb on the same server that <site> resides?
    – Laurie
    May 17, 2011 at 20:00
  • The command is being executed from the same server as the site.
    – Emon
    May 17, 2011 at 21:45
  • Have you tried to enumerate existing SPWebs? Try filtering the output: Get-SPWeb | Select-Object -Prop Url,Title,Id | Where-Object {$_.Url -like <site>}. May 18, 2011 at 4:27
  • By the way in some complicated cases there could be IIS redirects or ISA publications involved. Make sure you use an URL defined in Alternate Access Mappings, not something that redirects your requests thereto. May 18, 2011 at 4:30
  • A funny question: have you tried filtering the ULS logs for the period of when you execute the Get-SPWeb? You could gain gain insight from the output of Merge-SPLogFile -StartTime $datetime1 May 20, 2011 at 18:54

7 Answers 7


The account will need permissions on the content database. Just executing:

Add-SPShellAdmin CONTOSO\User1

Will give you access to the configuration database, but not the content database. Also provide access to the content database by giving access to the content database by using the -database parameter

Add-SPShellAdmin -UserName CONTOSO\User1 -database 4251d855-3c15-4501-8dd1-98f960359fa6

You can offcourse provide access to all content databases and SharePoint service application databases by using a command like:

Get-SPDatabase | Add-SPShellAdmin CONTOSO\User1


If you are running this from the server, you will need to make sure you "run as administrator" also, the farm account is the account that is used for the identity for Central Admin. You can grant other accounts privileges to run PowerShell Commands, and you have to do this if you are going to use a non-farm admin account to run PowerShell. You can find that information here: http://technet.microsoft.com/en-us/library/ee806878.aspx#section3

  • Thanks Lori. The user account in question has those right...
    – Emon
    May 17, 2011 at 21:45

Besides shell admin rights (not even sure that is needed), the account you execute the command with needs permissions to access the site/web, either though policy on webapplication or on site/web level. Farm admin rights would also be enough but is i see it is not needed.

Is the command you write exactly as you specify? I assume you know you need to replace <site> with either a valid identity for SPWebPipebind (web guid, web url or SPWeb object) or a valid site for SPWebSiteBind


Get-SPWeb -Identity http://intranet/newssite
Get-SPWeb -site http://intranet

Does the web you specify exist? Try entering same url in browser and log in tith same user to check this

  • 1
    I am specifying the web url in the command. The web does exist as I can visit the site through a browser using the same user account.
    – Emon
    May 17, 2011 at 21:39

So it looks like you need to be a Farm admin in order to run this command, even though its a simple command... Hopefully somebody will find it helpful.

  • You must also be in the Shell_Admin role in the databases: use Add-SPShellAdmin to add someone. But read about it first. May 20, 2011 at 7:36
  • The user I tried with first had the Shell_Admin and db_owner role already, not sure why it didn't work
    – Emon
    May 20, 2011 at 13:41
  • You don't need to be a farm admin to run PS scripts against SP. Apr 17, 2018 at 15:57

Make sure the url you specify isn't using %20 as a replacement for spaces.


If it is load balanced URL, check if the URL is accessible from that server, in my case I had to update the hosts file to the correct DNS because it was a BCP server.


Make sure the account you are running the powershell has access to the site collection content database.

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.