Get site template by Powershell

08/02/2013 12:51

With these few lines you can find out, what site template is used by which site collection

$webapp = Get-SPWebApplication -identity https://webapplicationUrl

$webtem = Get-spwebtemplate

#Get all site collections with publishing site template
$webapp.Sites | Where-Object {(Get-SPWeb $_.URL).WebTemplate -match "CMSPUBLISHING"}
#or
foreach ($site in $webapp.Sites)
{
 $spweb = get-spweb $site.URL
 write-host “Site URL: ” $site.URL
 write-host “Web Template: ” $spweb.WebTemplate
 write-host “WebTemplateID: ” $spweb.WebTemplateID
 write-host “————————————-”
}