One of a kind–Create a SharePoint 2013 Sitetemplate overview

If you are not living under a rock you might have noticed that SharePoint 2013 made its first appearance to the public a little while ago. I get asked a lot to demonstrate new features and the new sites or setup little playground environments where customers can play on.

To ease things up a little bit I have created a little powershell script which creates one site per site-template and also creates a html output where you can see the sites created and click the url.

All the sites get created in a dedicated content database which also gets created by the script.

Disclaimer: Of course you never… really never…did I say never ever??? just run scripts you find on the internet which you don’t understand… Don’t blame me for whatever happens. You are running these lines on your own risk.

Add-PSSnapin "Microsoft.sharepoint.powershell"

$templates = Get-SPWebTemplate
$url = "http://yourURL"
$siteadmin = "domain\user"
$contentdbname = "SharePoint2013_TemplateDemo"
$reportlocation = "c:/Templateoverview.html"

write-host -fore Green "Creating new Contentdatabase"
New-SPContentDatabase -Name $contentdbname -WebApplication $url 

foreach($template in $templates)
    $templateurl = $url +"/sites/"+ $template.title
    $templatename = $

    new-spsite -Url $templateurl -Template $templatename -OwnerAlias $siteadmin -ContentDatabase $contentdbname -ErrorVariable $err -ErrorAction SilentlyContinue 
    if ($err)
        write-host -fore red "An issue occured when creating site:" + $templateurl
         write-host -fore Green "A site based on template" $template.title "has been created successfully"
         out-file -FilePath $reportlocation -inputobject "<a href='$templateurl'>$templatename  $templateurl</a></br>" -Append


write-host "Find a clickable overview of all sites created by this script at:" + $reportlocation

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: