While creating new site collection from central admin, we can select a site template from Template Selection section. But some times, we may need to create sites from the power shell using CMDlet commands. At that time we need provide the site template name not the site template Title. So in order to know the site template name we will use Get-SPWebTemplate command. Get-SPWebTemplate command is available from SharePoint-2010 version.
Get-SPWebTemplate command displays all globally installed site templates from SharePoint that match the given identity.From the SharePoint management Powershell if we type Get-SPWebTemplate , it will displays the list of site templates available with parameters as Name,Title, Locale ID and Compatibility Level.
Get specific site template details with Name:
Get-SPWebTemplate "Template Name" - Displays site template details which are specific to the template name.
Ex: Get-SPWebTemplate "STS#1"
Create New Site from Power Shell with Template Name:
$templatename = Get-SPWebTemplate "STS#1"
New-SPSite "siteURL" –OwnerAlias "domain\compName" –Template $templatename
Get which template is mapped to SharePoint site:
In order to know which template is mapped to SharePoint site, use the below command.
$spweb = Get-SPWeb "http://urlofsite"
$spweb.WebTemplate - Gives you the site Template Name
$spweb.WebTemplateId - Gives you the site Template ID
Get site template details with *:
Even we can put a like kind of operand in Get-SPWebTemplate command to know the SharePoint template names which starts with a specific name.
Get-SPWebTemplate "MPS*" //output will be template names starts with MPS
Get All installed site templates:
Finally i tried to execute the Get-SPWebTemplate to know the list of site template from my sharepoint(2013 version) and listed the few result details below. Even you can run this command to know the list of templates available from you SharePoint.
Name Title LocaleId CompatibilyLevel
---- ----- -------- ---
GLOBAL#0 Global template 1033 15
STS#0 Team Site 1033 15
STS#1 Blank Site 1033 15
STS#2 Document Workspace 1033 15
MPS#0 Basic Meeting Workspace 1033 15
MPS#1 Blank Meeting Workspace 1033 15
...
....you will get more results.