1

I want to get the RootWeb object from my sub web object using PowerShell.

$site=  get-spsite "http://srvr1:123/sites/ceo"
$rootwebb=  $site.RootWeb
$suburl= get-spweb "http://srvr1:123/sites/ceo/hr/policies"
$subweb= get-spweb $suburl
#how to get the  rootweb object from $subweb ?
  • Not sure what you mean, a site collection has a root web. A web is by definition a web so it has no root web. By getting $subUrl you are getting that web there is no further root. Maybe if you explain what you are trying to achieve? – Bunzab May 30 '15 at 14:05
13

You can use

$SubWeb.Site.RootWeb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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