Here's a quick script for enumerating all of the available site definitions, their configurations, and any site templates installed on a SharePoint Server. If you're creating sites programmatically, this comes in handy as you'll likely rely on these values in a configuration document somewhere:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$url = "http://MySite"
$site= new-Object Microsoft.SharePoint.SPSite($url )
$web= $site.OpenWeb()
$loc= [System.Int32]::Parse(1033)
$templates= $site.GetWebTemplates($loc)
foreach ($child in $templates)
{
write-host $child.Name $child.Title $child.ID
}
write-host done
Posted
12-11-2006 7:00 AM
by
mhodnick