Determine Site Template

Another day, another PowerShell script! This time a script that will return details about the Site Template that a SharePoint site is using. A customer of mine has a large number of custom site definitions and regularly needs to determine the template that a specific site uses to aid with troubleshooting. Very simple script, but I thought it was worth sharing anyway.

The default behaviour of the script is to output the Title, Name and Description of the template used (highlighted in the script). This can be changed to meet your requirements, the following properties are available:

Simply save the following as a .ps1 file and execute passing the script the URL of a site as an argument (either an SPSite or SPWeb).

ASNP *SharePoint* -EA SilentlyContinue
$Web = Get-SPWeb $Args[0]
$Template = $Web.WebTemplate + "#" + $Web.Configuration
Write-Host "This site is using the following template:" -ForegroundColor Green
Get-SPWebTemplate | Where {$_.Name -eq $Template} | Select Title, Name, Description | Format-List

 Here is an example of the script in action.

 

Brendan Griffin