Monday, September 2, 2013

How to Hide Site Templates in SharePoint with PowerShell

How to hide a site template in SharePoint ? Editing "webtemp.xml" file is one option to hide site templates in SharePoint 2007 as per my another article: Hide Site templates & List Templates in SharePoint

However, There is an another way to hide site templates in SharePoint 2010: Using PowerShell! Update "WebTemplates" property of SPWeb object. Say for E.g. The below script sets available web templates to "Team sites" and "Blog". All others will be removed!

$Web = Get-SPWeb ""

$Web.AllProperties["__WebTemplates"] = "<webtemplates><lcid id=""all""><webtemplate name=""STS#0"" /><webtemplate name=""BLOG#0"" /></lcid></webtemplates>"

#To Reset to Default, Use: $Web.AllowAllWebTemplates()

Just supply the site template ids to the above code to make it available. You can hide custom site templates as well. To get all available site templates, use: Get-SPWebTemplate SharePoint Site Template IDs Reference

Here is the Before and After screens:
hide site templates sharepoint 2010
After Executing the Script:
hide site template sharepoint
Hiding SharePoint site template can be achieved using C# Object model also. Manipulate SPWebTemplateCollection of SPWeb object and update it to to hide a site template in sharepoint 2010 or in SharePoint 2007.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:


  1. where i have to execute this code??

    As java SCRIPT or when?? please guide me on this. Thanks

    1. Its a PowerShell Script! Execute it using SharePoint PowerShell Management Shell or PowerShell ISE from your WFE.


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...