SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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 am looking for a quick way to export all sub-sites from a web application and exclude the root url, is there a quick way to accomplish this?

share|improve this question
up vote 0 down vote accepted

maybe this can help :

Get-SPSite http://yourwabapp/sites/sitecol | Get-SPWeb | Where-Object  { $_.ParentWeb -Ne $null } | ForEach-Object { Export-SPWeb -Identity $_ -Path $_.ID }

you will need to adjust the export params according your needs

share|improve this answer
great thanks this works, is there a way to make it a single export or does it need to export each subsite individually? – Adonis L Jun 29 '11 at 11:24
I would need to import the sites as well as there are a lot, i would like to do it with a single import command – Adonis L Jun 29 '11 at 11:32
Just loop through the exported sites using PowerShell, and import each one. Something like dir $folderpath | For-Each {Import-SPWeb -Path $_.FullName -(Additional import parameters...) – tarjeieo Jun 29 '11 at 12:34

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.