1

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.

3
  • 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, 2012 at 13:14
  • 1
    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, 2012 at 9:05
  • Yes, please add an answer. It looks like from your example code you had a space between the - and Identity? Jun 23, 2013 at 0:00

1 Answer 1

1

Q: Is is local? It is remote (another server) you need to enable Powershell Remote (see here http://blogs.msdn.com/b/opal/archive/2010/03/07/sharepoint-2010-with-windows-powershell-remoting-step-by-step.aspx)

Also make sure you got the right of course use this http://bramnuyts.be/2011/06/08/get-spweb-cannot-find-an-spweb-object-with-id-or-url/

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

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.