Adding and Removing SharePoint Templates from a Web

In certain cases you may not want Site Collection Administrators or otherwise delegated users to use a certain type of Web template. This can be achieved using 3rd party tools quite easily, or if Publishing is turned on at the Site Collection level. However, in some cases neither of these options are available. In this case, we can do it with PowerShell. You will need your LCID (Language ID), in this case, 1033, or English.

$web = Get-SPWeb http://webUrl
$collection = @($web.GetAvailableWebTemplates(1033))
$collection2 = $collection | where {$_.Name -ne "COMMUNITY#0"}
$web.SetAvailableWebTemplates($collection2, 1033)
$web.Update()

To add a template back into the list, run:

$web = Get-SPWeb http://webUrl
$collection = @($web.GetAvailableWebTemplates(1033))
$webtemplate = Get-SPWebTemplate | where {$_.Name -eq "COMMUNITY#0"}
$collection2 = $collection + $webtemplate
$web.SetAvailableWebTemplates($collection2, 1033)
$web.Update()

The change will appear when a user attempts to create a new Web of the selected Web.

Trevor Seward is a Microsoft Office Apps and Services MVP who specializes in SharePoint Server administration, hybrid scenarios, and SharePoint Online. He has been working with SharePoint for 16 years from SharePoint 2003 on up, managing environments with terabytes of content for 150,000+ user organizations. Trevor is an author of Deploying SharePoint 2016 and Deploying SharePoint 2019. You can find him on Twitter and in /r/sharepoint.