Save Site as Template in SharePoint using PowerShell

How to save the site as a template in SharePoint 2013?

The easiest way to create a standard template for your SharePoint sites is to create a site,  Add-remove content, list, and libraries, and save the site as a template from Site Settings >> Save Site as a template. – Shortcut URL: “/_layouts/savetmpl.aspx”

Save Site as Template in Sharepoint 2013 using PowerShell

Save Site as Template in SharePoint using PowerShell

You can save your site as template even with the publishing feature using the following PowerShell script:

$WebURL = "https://your-site-collection-URL"

#Get the Web Object
$Web= Get-SPWeb $WebURL

#Variables for Save site as template settings
$TemplateName ="PMO Site Template"
$TemplateTitle ="PMO Project Site Template" 
$TemplateDescription ="Site template for PMO project management portal"

#Option to Save with content
$SaveWithContent= 1  #0 otherwise

#Save site as template programmatically with PowerShell
$Web.SaveAsTemplate($TemplateName,$TemplateTitle,$TemplateDescription,$SaveWithContent)

The saved template will be available under the site collection “Solutions” gallery. Once saved, you can import this WSP (it was .stp in SharePoint 2007 days!) file from the solution gallery into Visual Studio and customize it further. You can also upload the WSP file to other site collections to add this new site template.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *