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

I am executing the below script to get all libraries name in subsite:

Get-SPweb http://server:80/sites/sitename/subsitename |
   Select -ExpandProperty Lists |
   Where { $_.GetType().Name -eq "SPDocumentLibrary" } |
    Select Title

I am getting error: Cannot find an SPWeb object with id or url :......

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I don't recall the reason, but I had also faced this problem and the solution was to first create SPSite object and use it in get-spweb.

$siteURL = "http://server:80/sites/sitename"
$webURL = "/subsitename"
$site = get-spsite $siteURL
get-spweb -site $site $webURL
share|improve this answer

Your Answer

 
discard

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.