SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 can successfully connect to the "Shared Documents" library at root site and add a file to it. What I can't do is connect to a library that is a few layers down so I can add the file:

The Root Site is: http://mycompany/sites

Connection code:

 $web =Get-SPWeb "http://mycompany/sites"
 $spFolder= $web.GetFolder("Shared Dcouments")
 $web =Get-SPWeb "http://mycompany/sites/Operations/IT"
 $spFolder= $web.GetFolder("Shared Documents")

I have tried:

 $web =Get-SPWeb - identity "/Operations/IT"  -site "http://mycompany/sites"
 $web =Get-SPWeb - identity "http://mycompany/sites/Operations/IT"

No matter how I do it, I can an error similar to: Get=SPWeb :

Cannot find an SPWeb onject with ID or URL : http://mycompany/sites/Operations/IT

I am very new to powershell, and fairly new to SharePoint- there may be a simple answer, but I can't find it.

share|improve this question
I found the correct syntax- not sure why it wasn't working earlier: $SubSiteUrl="mycompany/sites/operations/it"; $web =Get-SPWeb -Identity $SubSiteUrl – Rick Apr 23 '12 at 13:14
If you find the answer, please use the answer tool, not comment. Then mark your questions as answered. This will help future user with the same kind of issue to find the solution – Steve B Sep 10 '12 at 9:05
Yes, please add an answer. It looks like from your example code you had a space between the - and Identity? – Robert Kaucher Jun 23 '13 at 0:00

Q: Is is local? It is remote (another server) you need to enable Powershell Remote (see here

Also make sure you got the right of course use this

The simple should be $spWeb = Get-SPWeb -Identity http://sp.local not even needed to put it in the quotes!

Afterwards use the $spWeb variable to do anything on it.

Make sure you can access it by browser of course.

Hope it helps, C:\Marius

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.