I have some custom site templates.. Now i want to just hide those templates from the Site Creation List..

I found some ways to like editing webtemp.xml and doing it from UI for each site collection.. editing webtemp.xml is not fair because im doing this on production environment and Doing it from the UI also not a solution..

But because im doing production deployment i want script to do this.. I just want code snippert to hide those custom templates..

And i want to say that disabling Templates won't meet my requirements.. because it will ruined my created sites from those templates..


We can hide the site templates using powershell, the below powershell script will remove all the templates other than "Team sites" and "Blog".

$Web = Get-SPWeb "http://sharepoint.crescent.com/teams/"

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

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


You can hide custom site templates as well, just by passing the template ID's in the above code.

SharePoint Site Template IDs Reference

We can also hide the site templates programmatically, use the below link to do it programmatically.

Hiding SharePoint 2010 web templates programmatically


Please test the above powershell code in your test environment and then use it in production environment.

Hope this helps you.

  • So Karthik i have mention here the templates i needed to remain in the site.. And i have 1 question is this affecting to whole farm or just for the site collection.? Oct 15 '13 at 10:54
  • @tharindlaksh, as we are mentioning the site collection URL and creating a web object, it will be done to a particular site collection. try it in your test server and then use it in production server. put your custom templates ID in the above code and remove it . Oct 15 '13 at 12:28
  • So to be clear the templates i want to hide i want put in $Web.AllProperties["__WebTemplates"] = "<webtemplates><lcid id=""all""><webtemplate name=""STS#0"" /><webtemplate name=""BLOG#0"" /></lcid></webtemplates> section know.? Oct 15 '13 at 12:36
  • yes, correct, you have to put it there only. Oct 15 '13 at 13:48
  • Actually Karthik the thing is i want to mention here the templates i want to remain in the server.. anyway problem is solve.. But i got another problem because of im hiding those the templates i deployed after will also hide because i had to mention reamining templates here.. Oct 16 '13 at 4:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.