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
When implementing a custom Feature in SharePoint 2007, you may rely on custom configuration data (in a custom configuration section) stored in a SharePoint site's web.config file. When activating and deactivating your feature through the SharePoint site settings user interface, this works just fine. However when using the STSADM.EXE command-line tool to activate and deactivate features, there is no web context and the tool does not run within the context of a SharePoint site. Thus if your feature relies on custom configuration data in a config file, the configuration data will not be available when using STSADM.EXE.
You can address this problem by creating (or modifying) a file named STSADM.EXE.config that resides in the same folder as STSADM.EXE (c:\program files\common files\microsoft shared\web server extensions\12\bin). This file is just an application configuration file (e.g. app.config), and you can add custom configuration data to it like any other web.config or app.config file. Keep in mind that this is a server-wide config file. Any customizations or changes you make will affect all uses of STSADM.EXE on all sites on the server.