SharePoint Dragons

Nikander & Margriet on SharePoint

Category Archives: Powershell

Can’t use PowerShell to create a site using a site template

Just stumbled across this. It’s not possible to use PowerShell to create a site based on a site template.

In this example, we’ve created a site template called “mytemplate” based on the “STS” template. Normally, you can use the new-spweb cmdlet and specify a template like so:

new-spweb http://moon/sites/sc1/autosite1 -template “mytemplate”

(Or add –whatif to the end if you’re getting cold feet).The –tempate parameter accepts a piped spwebtemplate object, which can be retrieved via:

Get-SPWebTemplate | more

As you will see, a site template saved in the site collection solution catalog won’t show up here. As an alternative, you can try to establish the template that was used to create an existing web site, like so (please note, we’ve created a site called “myinstance” using the “mytemplate” site template:

$web = get-spweb http://moon/sites/sc1/myinstance

write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateId


If you experiment with this, you will find that the web template it still the underlying parent of the saved template. In my case “mytemplate” was based on the “STS” template, so that’s still the one that is actually the web template of “myinstance”.

PowerShell script for monitoring SharePoint WFE’s and SQL Server back-ends

Choosing, and automating the monitoring of, the correct set of performance counters for monitoring SharePoint WFE’s and back-ends is a daunting task, and this is my attempt:

PowerShell in a month of lunches

We regularly review technical books, and occasionally we like to give a thumbs up to the most interesting ones we see. This is the case for “PowerShell in a month of lunches” by Don Jones ( ). Don’t let the title fool you, this is not a “for Dummies” book. Don Jones not only does a great job teaching PowerShell, he also is great in demonstrating how to learn PowerShell, a subtle but big difference.