sharepointpowershellsharepoint-2010powershell-2.0spweb

Get SPWebTemplate from SPWeb


In my PowerShell script, I want to get the SPWebTemplate which has been used to create a SPWeb. In SPWeb instances, properties WebTemplate and WebTemplateId are accessible, but both of them dont identify a SPWebTemplate uniquely.

For example, if the SPWebTemplate "STS#0" has been used to create a SPWeb, WebTemplate would contain "STS" and WebTemplateId be "1".

Now

Get-SPWebTemplate | where { $_.ID -eq 1 }

would result in 3 results for each installed language (STS#0, STS#1, STS#2). How can I retrieve the correct SPWebTemplate-Name (STS#1)?

Thanks in advance,
Jonas


Solution

  • Try SPWeb.Configuration.

    This property has to be in the running for Most Poorly Named Property - SharePoint API. I remember trying to use WebTemplateId myself until I found Configuration (and I don't remember how I eventually found it).