I am trying to understand how to restore an arbitrary library to an arbitrary site in an arbitary site collection - inspired by some future user announcing he accidentally deleted a document from the library (and recycle bin is not an option). Let's assume the user does not even know the document name but would recognize it if a copy of the lib were restored from a backup.

With that goal, I've been experimenting with some Powershell scripts which export sites in my farm. This one uses file compression by default:

Get-SPSite | foreach-object {
$_.allwebs | foreach-object {
    $ExportDir = "\\BLACKTIP\SharePointBackups\Export-WebSites\" + $_.Url.replace("http://","").Replace("/","-");
    $ExportFname = $ExportDir + ".cmp";
    Export-SPWeb -Identity $_.Url -Path $ExportFname -Force


Consider a given subsite HR within a site collection http://blacktip/sites/cbmi: I see the following files in the export directory:


I looked over the syntax for Import-SPWeb and tried a couple of things:

import-spweb `http://blacktip/sites/cbmi/restoreHR` -Path "C:\SharepointBackups\Export-WebSites\blacktip-sites-cbmi-HR.cmp"

The above is based on the hope that maybe it would create a subsite called restoreHR based on the properties of the exported site. Got error: Cannot find an SPWeb object with Id or Url : http://blacktip/sites/cbmi/restoreHR which of course makes sense.

So, I created a subsite called HRrestored (not knowing what template to use) and then I got this error: Cannot import site. The exported site is based on the template STS#1 but the destination site is based on the template STS#0. You can import sites only into sites that are based on same template as the exported site.

What are the best practices for something like this? How to the "pros" handle these sort of ad-hoc requests for restoration of arbitrary resources within Sharepoint (assuming granular backups have been taken, what are best practices for restoring things?).

1 Answer 1


It seems that source and destination sites are not created from the same template. The source site is based upon Blank Site template (STS#1) but the destination site is based upon Team site template (STS#0). So, create a site with Blank site template and perform the import again.

Here is the list of site templates: http://blogs.technet.com/b/araviraj/archive/2008/06/18/sharepoint-templates-types.aspx

More about backing up Sites or list: http://technet.microsoft.com/en-us/library/ee428301.aspx


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.