Is there a way to import/export or backup/restore a sub site? I have a site collection at http://someurl.mycompany.com/sites/content. I have sub sites under that site collection that were created by going to Site Settings > Site Administration > Sites and Workspaces, and then clicking the 'create' button. Are there any powershell or stsadm commands for exporting/importing one of these sub sites?

2 Answers 2


You can use the Export-SPWeb and Import-SPWeb cmdlets:

Import-SPWeb: http://technet.microsoft.com/en-us/library/ff607613(v=office.14).aspx

Export-SPWeb: http://technet.microsoft.com/en-us/library/ff607895(v=office.14).aspx


You can do it in powershell via the Backup-SPSite command:

$siteCollection = "http:\\mysite.com"
add-PSSnapin Microsoft.Sharepoint.Powershell

$sites=Get-SPWebApplication $siteCollection | 
    Get-SPSite -limit ALL|
       Get-SPWeb -limit ALL

foreach($site in $sites){
    Backup-SPSite -Identity $site.Url -Path "$backupfolder\$($site.Title)" -Force
    Write-Host "Successfulle backed up $($site.Url) to $backupfolder\$($site.Title)"

The example above backs up all subsites for the given site collection.

You can also do it in SharePoint Central Admin by going to:

  • click heading 'Backup and Restore' -> Export a site or list
  • drill down to the site collection and subsite you wish to backup
  • the filename field will be the path on the server that the central admin application is running on (ie, 'C:\backup.cmp' ). If you want to write to a network share, you can enter that as well. Just make sure that the account that SharePoint is running as has write access to the specified location.

To import the site, you can also use powershell. The only caveat is that you must first create the subsite as a 'dummy', and you MUST use the same template. For example, if the site you backed up was based on the 'Teamsite' template, the URL that you are trying to restore to MUST already represent a subsite and it MUST be based on the Teamsite template.

The powershell command for importing a subsite backup located on the server at "C:\Backup.cmp" is:

 Import-SPWeb -Identity http://mysite.com/targetSubsite Path c:\\Backup.cmp -IncludeUserSecurity

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.