How to Get Site Template in SharePoint Using PowerShell?

In this PowerShell tutorial, I will explain how to get site template in SharePoint using PowerShell.

How to Get Site Template in SharePoint Using PowerShell

Let’s discuss how to get the SharePoint site template in PowerShell using two different approaches:

  1. SharePoint Online Management shell
  2. PnP PowerShell

Get Site Template in SharePoint Using SharePoint Online Management Shell

In SharePoint Online Management Shell, to display all the SharePoint site templates, we will use the below command:

Get-SPOWebTemplate

Note,

To run the above command in PowerShell, you shoulLetsd be the SharePoint Online administrator or Global Administrator.

Open Windows PowerShell ISE or Visual Studio code to execute the PowerShell commands. I will use Windows PowerShell ISE here.

Let’s connect the SharePoint admin center with PowerShell. Refer to the command below:

Connect-SPOService -Url https://szg52-admin.sharepoint.com -Credential (Get-Credential)

Example 1: To get all the SharePoint site templates using SharePoint Online Management Shell

  • After connecting to SharePoint Online. Follow the below script to get all the SharePoint site templates:
Get-SPOWebTemplate

After executing the script, we will receive 17 SharePoint site templates, such as:

NameTitle
STS#3Team site (no Microsoft 365 group)
STS#0Team site (classic experience)
BDR#0Document Center
DEV#0Developer Site
OFFILE#1Records Center
EHS#1Team Site – SharePoint Online configuration
BICenterSite#0Business Intelligence Center
SRCHCEN#0Enterprise Search Center
BLANKINTERNETCONTAINER#0Publishing Portal
ENTERWIKI#0Enterprise Wiki
PROJECTSITE#0Project Site
PRODUCTCATALOG#0Product Catalog
COMMUNITY#0Community Site
COMMUNITYPORTAL#0Community Portal
SITEPAGEPUBLISHING#0Communication site
SRCHCENTERLITE#0Basic Search Center
visprus#0Visio Process Repository
Get Site Template in SharePoint Using SharePoint Online Management Shell

Example 2: To get the SharePoint site templates with the selected properties

  • The script to get the SharePoint site templates with selected properties:
Get-SPOWebTemplate | Select-Object Name, Title, DisplayCategory
Get the SharePoint site templates with the selected properties using PowerShell

Example 3: Get only the SharePoint Team site template with a description

  • The script to get the SharePoint team site template with a description
Get-SPOWebTemplate | Where-Object { $_.Name -eq "STS#3"}| Select-Object Name, Title, Description
How to Get Site Template in SharePoint Using PowerShell

Example 4: To get the SharePoint site templates filtered by Publishing category

  • The script to get the SharePoint site templates filtered by Publishing category
Get-SPOWebTemplate | Where-Object { $_.DisplayCategory -eq "Publishing" }
Get Site Template in SharePoint Using PowerShell

This is how to get all the SharePoint site templates from the SharePoint Online Management shell.

Get Site Template in SharePoint Using PnP PowerShell

We use the Get-PnPSiteTemplate command in PnP PowerShell to get all the SharePoint site templates.

First, you should connect SharePoint Online with PowerShell. Follow the Connect-PnPOnline command to connect.

Connect-PnPOnline https://szg52-admin.sharepoint.com 

To run this PowerShell command, I will use a Visual Studio Code.

Example 1: To get all the SharePoint site templates using PnP PowerShell

  • After connecting to SharePoint Online. Follow the below script to get all the SharePoint site templates:
Get-PnPSiteTemplate

But if we run this script, the output will be in the XML, as shown below:

Get SharePoint Site Template Using PnP PowerShell

If we need to get all the SharePoint site templates in a table format through pnp, follow the script below:

Get-PnPTenantSite -Detailed | ForEach-Object {
    [PSCustomObject]@{
        Template = $_.Template
        Title = $_.Title
    }
} | Format-Table -AutoSize

After executing the above script, we will receive many SharePoint site templates, such as:

NameTitle
GLOBAL#0Global template
STS#3Team site (no Microsoft 365 group)
STS#0Team site (classic experience)
STS#1Blank Site
STS#2Document Workspace
MPS#0Basic Meeting Workspace
MPS#1Blank Meeting Workspace
MPS#2Decision Meeting Workspace
MPS#3Social Meeting Workspace
MPS#4Multipage Meeting Workspace
CENTRALADMIN#0Central Admin Site
WIKI#0Wiki Site
BLOG#0Blog
SGS#0Group Work Site
TENANTADMIN#0Tenant Admin Site
APP#0App Template
APPCATALOG#0App Catalog Site
ACCSRV#0 Access Services Site
ACCSVC#0Access Services Site Internal
ACCSVC#1Access Services Site
BDR#0Document Center
CONTENTCTR#0Content Center
TBH#0In-Place Hold Policy Center
DEV#0Developer Site
EDISC#0eDiscovery Center
EDISC#1eDiscovery Case
EXPRESS#0Express Team Site
FunSite#0SharePoint Online Tenant Fundamental Site
OFFILE#0(obsolete) Records Center
OFFILE#1 Records Center
EHS#0Express Hosted Site
EHS#2Public Publishing Portal
EHS#1Team Site – SharePoint Online configuration
OSRV#0Shared Services Administration Site
PPSMASite#0PerformancePoint
BICenterSite#0Business Intelligence Center
PWA#0Project Web App Site
PWS#0Microsoft Project Site
REVIEWCTR#0Review Center
RedirectSite#0Redirect Site
POLICYCTR#0Compliance Policy Center
SPS#0SharePoint Portal Server Site
SPSPERS#0SharePoint Portal Server Personal Space
SPSPERS#2Storage And Social SharePoint Portal Server Personal Space
SPSPERS#3Storage Only SharePoint Portal Server Personal Space
SPSPERS#4Social Only SharePoint Portal Server Personal Space
SPSPERS#5Empty SharePoint Portal Server Personal Space
SPSPERS#6Storage And Social SharePoint Portal Server Personal Space
SPSPERS#7Storage And Social SharePoint Portal Server Personal Space
SPSPERS#8Storage And Social SharePoint Portal Server Personal Space
SPSPERS#9Storage And Social SharePoint Portal Server Personal Space
SPSPERS#10Storage And Social SharePoint Portal Server Personal Space
SPSPERS#11Consumer OneDrive
SPSPERS#12JIT OneDrive Business
SPSPERS#13JIT OneDrive Consumer
SPSMSITE#0Personalization Site
SPSTOC#0 Contents area Template
SPSTOPIC#0Topic area template
SPSNEWS#0News Site
CMSPUBLISHING#0Publishing Site
BLANKINTERNET#0Publishing Site
BLANKINTERNET#1Press Releases Site
BLANKINTERNET#2Publishing Site with Workflow
SPSNHOME#0News Site
SPSSITES#0Site Directory
SPSCOMMU#0Community area template
SPSREPORTCENTER#0Report Center
SPSPORTAL#0Collaboration Portal
SRCHCEN#0 Enterprise Search Center
PROFILES#0Profiles
BLANKINTERNETCONTAINER#0Publishing Portal
SPSMSITEHOST#0My Site Host
ENTERWIKI#0Enterprise Wiki
PROJECTSITE#0Project Site
PRODUCTCATALOG#0Product Catalog
COMMUNITY#0Community Site
COMMUNITYPORTAL#0Community Portal
GROUP#0Team site
POINTPUBLISHINGHUB#0PointPublishing Hub
POINTPUBLISHINGPERSONAL#0Personal blog
POINTPUBLISHINGTOPIC#0PointPublishing Topic
SITEPAGEPUBLISHING#0Communication site
TEAMCHANNEL#0Team channel
TEAMCHANNEL#1Team channel
CSPCONTAINER#0CSP Container
SRCHCENTERLITE#0Basic Search Center
SRCHCENTERLITE#1Basic Search Center
TenantAdminSpo#0SharePoint Online TenantAdmin
TestSite#0Test Site
visprus#0Visio Process Repository
SAPWorkflowSite#0SAP Workflow Site
How to get SharePoint Site Template using the PnP PowerShell

Example 2: Get only the SharePoint Team site template with a description

  • The script to get the SharePoint team site template with a description:
Get-PnPTenantSite -Detailed | Where-Object { $_.Template -eq "STS#0" } | Format-Table -Property Title, Url, Template, StorageUsageGB -AutoSize
How to Get Site Template in SharePoint Using PnP PowerShell

Example 3: To get the SharePoint site templates filtered by Publishing category

  • The script to get the SharePoint site templates filtered by Publishing category
Get-PnPTenantSite -Template "STS#0" -Detailed | Format-Table -Property Title, Url, Template -AutoSize
How to Get SharePoint Site Template through PnP PowerShell

This is how to get all the SharePoint site templates from the PnP PowerShell.

Get a Specific SharePoint Site Template Name Using PowerShell

Let us check how to get a specific SharePoint site template name through PnP PowerShell:

  • The script to get a specific SharePoint site template name through PnP PowerShell:
Get-PnPTenantSite -Identity "https://szg52.sharepoint.com/sites/SharePointOnlineTraining" -Detailed | select Template

After executing the above script, we will get the SharePoint site template name as shown below:

Get a Specific SharePoint Site Template Name Using PowerShell

The result was “GROUP#0“, which means it is a ‘Team site‘.

So, these are some ways you can get SharePoint site templates in different approaches.

Later, if you have a SharePoint site and need to know its template name through PowerShell, refer to the steps above.

I hope you found this tutorial helpful!

Also, you may like some more PowerShell articles: