SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Are you executing Get-SPWeb on the same server that <site> resides? – Laurie May 17 '11 at 20:00
The command is being executed from the same server as the site. – Emon May 17 '11 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>}. – Alexey Krasheninnikov May 18 '11 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. – Alexey Krasheninnikov May 18 '11 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 – Alexey Krasheninnikov May 20 '11 at 18:54

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:

share|improve this answer
Thanks Lori. The user account in question has those right... – Emon May 17 '11 at 21:45

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

share|improve this answer

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

share|improve this answer
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 '11 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.

share|improve this answer
You must also be in the Shell_Admin role in the databases: use Add-SPShellAdmin to add someone. But read about it first. – Alexey Krasheninnikov May 20 '11 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 '11 at 13:41

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

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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