Thursday, November 17, 2011

How to save a site as template using PowerShell

Here is Powershell script to save a site as template.

$SiteUrl = "http://Sharepoint2010/site"
$Web=Get-SPWeb $SiteUrl
$Web.SaveAsTemplate("Template Name","Template Title","Template Description",1)

The last parameter of SaveAsTemplate() can be 0 or 1. 1 if you want to save the site with data else 0.
Make sure you open the SharePoint Management Shell as Administrator.

No comments:

Post a Comment