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

$web.Dispose()

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”.

Advertisements

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:

http://gallery.technet.microsoft.com/PowerShell-script-for-59cf3f70

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 ( http://www.amazon.com/Learn-Windows-PowerShell-Month-Lunches/dp/1617290211/ref=sr_1_1?s=books&ie=UTF8&qid=1317110718&sr=1-1 ). 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.