How to Find the Site Template in SharePoint Online using PowerShell?

Requirement: Find Site Template in SharePoint Online using PowerShell.

How to Find the Site Template in SharePoint Online?

Say for e.g. You may want to know if it is a team site in SharePoint Online. To check the site template of your site, do the following:

  • Open your SharePoint Online site collection or subsite in the browser, Go to View >> Page Source. 
  • In the page source, search for “webTemplateConfiguration”, and you’ll find the site template value next.
    Find Site Template in SharePoint Online

How to Find the Site Template in SharePoint Online using PowerShell?

Use this PowerShell to get the site template of a site collection:

#Set Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
$SiteURL="https://crescent.sharepoint.com/sites/marketing"

#Connect to SharePoint Online
Connect-SPOService -Url $TenantAdminURL -Credential (Get-Credential)

#Get Site Template of the Site Collection
(Get-SPOSite -Identity $SiteURL).Template

Get Site Template of a Sub-Site using PowerShell:

Let’s retrieve the template of a subsite using PnP PowerShell.

#Set Parameters
$SiteURL="https://crescent.sharepoint.com/sites/marketing/us"

#Connect to Site
Connect-PnPOnline $SiteURL -Credentials (Get-Credential)  #-UseWebLogin

#Get Template of the Web
$Web = Get-PnPWeb -Includes Configuration, WebTemplate

Write-host "Site Template: $($Web.WebTemplate)#$($Web.Configuration)"

You can refer to this post to get all site template IDs Get Site Templates in SharePoint Online using PowerShell

You can also use the “SharePoint Manager” tool to get the site template of a SharePoint Online site, as in my other article: How to Get the Web Template Used in a SharePoint Site?

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply