Backup and Restore in SharePoint - Part 2

You have seen backup and restore activity of list in SharePoint 2013 of part 1. In this post you will learn how to take backup of the site and site collection and restore it to a different site or site collection using various options.

Backup site:

To take the backup of the site we can below options.

  • Save site as template
  • Powershell

Save site as Template:

Out of Box Option:

Go to [site settings] [site actions]

Click on Save site as template.

Fill the details shown in the below screen 

And click on ok.

It will be stored in [Solutions] solution Gallery under [web designer gallery].

Select the solution that is saved and activate it.

When you try to create a site, you can create by selecting the custom tab and you will see the site template which you have activated.

Some times what happens is you don't see option "save site as template ". No problem what you can do you can try to open the URL  "_layouts/15/savetmpl.aspx" directly to save site as template.


You can Save site as template using powershell as well.

#Example of using SaveAsTemplate of Get-SPWeb method

$Web=Get-SPWeb $Web.SaveAsTemplate("Template Name","Template Title","Template Description",1)

Once you run the above command the template will get saved in solutions gallery.

Note: If there are any dependency features on that site then you will get below error. 

So you have find the feature details based on the above error and try to activate in site collection where you want to create the site based on a site template.

Use the tool developed by Serge Luca.

To find more details about correlation ID, Please check here.

Activate Feature:

Once you find the feature, you can activate using below powershell command.

#Example of Activating the Feature on site

Enable-SPFeature –identity V2VPublishedLinks -URL

Powershell Commands to Export and Import Site:

Export site:

You can use below powershell commands to perform backup and restore commands.

#Using export-spweb command

export-spweb -identity "< URL > -path < Path >

<URL> URL is site url which you want to take the backup.

<path> physical file path where you need to save the backup file.

#Example of using export-spweb to take the backup of site

export-spweb -identity "" -path "E:\SharePointBackups\Tutorials.cmp"

Import site:

Before importing the site you need to make sure you have the same template for both the sites otherwise you will get below error.


web template Name and Id:

To avoid that you can check the template Id using below powershell script.

#Example of getting web template Name and Id details

$web = Get-SPWeb "" write-host "Web Template:" $web.WebTemplate " | Web Template ID:" $web.WebTemplateId

Creating New site:

Once you know the Site Template details you need to create a site based on that template.

#Example of creating site

New-SPWeb "" -Template "SPSTOPIC"

The above command works fine if the Template is available, but few cases it will not available so it does not get created.

It will give below message if a template is not available.

Warning " Template is not found and it's not applied."

If you try to open the site which you created, it will ask for template selection.

The site which you try to create using above powershell command will show under custom template section, so you can choose that one.

Select a template

This happens where the site is getting migrated from SPS 2003 to MOSS 2007 and then from MOSS 2007 to SP 2010.

Finally after resolving all the issue you can run the below command to perform the restore operation.

#Using import-spweb command

import-spweb -identity "< URL > -path < Path >

<URL> URL is site url where you want to restore the backup.

<path> physical file path where you have saved the backup file.

#Example of using import-spweb to restore site

import-spweb -identity "" -path "E:\SharePointBackups\Tutorials.cmp"

Restore and Backup site collection:

Backup site collection:

#Example of Back up site collection

backup-spsite -identity -path E:\SharePointBackups\Tutorials.bak

Restore site collection:

#Example of Restore site collection

Restore-spsite -identity -path E:\SharePointBackups\Tutorials.bak


In this article we have seen how to take backup and restore site and site collection using powershell.

It helps to resolve the issues we get while creating a site using save site as template, export and import site.  

You can check the List import and export here in Part 1.

› Backup and restore site and site collection

› Backup and restore site and site collection

Join 8,000 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers

About Author

Devendra Velegandla is a five-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2019) for Office Apps and Services, Office Servers and Services MVP and  SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.