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 :......

1 Answer 1


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

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.