SharePoint 2010: Provisioning a new site using a custom template

In SharePoint 2010, stps are no longer used. Instead site templates are saved as wsp files.

To create a new site collection using one of these template through the UI, you need to create a site collection through central admin that has no template selected. Once completed, browse to the site collection. From here, you are prompted to select a template. Instead of doing this, click the link to “solution gallery” and Upload your wsp file (previously exported). Once complete, go back to the choose template screen (at the root of the site collection) and select you new template from the “custom” tab.

image

Below is some powershell script that facilitates this…

[void][System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
New-SPSite -Url “
http://localhost:81/sites/robtest2″ -OwnerAlias “Administrator” -Description “Rob Test Site” -Name “Rob Test” -Language 1033
Add-SPUserSolution -LiteralPath “C:\Users\Administrator\Desktop\RobTestX.wsp” -Site “
http://localhost:81/sites/robtest2″
Install-SPUserSolution -Identity “RobTestX.wsp” -Site “
http://localhost:81/sites/robtest2″
$site = New-Object Microsoft.SharePoint.SPSite(“
http://localhost:81/sites/robtest2″)
$web = $site.OpenWeb();
$template = $web.GetAvailableWebTemplates(1033) | Where-Object {$_.Name -like “{*” }
$templateName = $template.Name
$web.ApplyWebTemplate($templateName)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>