Restrict the New Site Available Templates with Powershell
I recently had to work on a project where I had to only let users create “New Site” with only a few numbers of Templates. You can easily do it by the GUI, but how do we do it in PowerShell?
$mainurl = “http://vlad.test.loc”
$Web = Get-SPWeb $mainurl
$Web.AllProperties[“__WebTemplates”] = “”
Also if you want to use a Custom Template you can use this syntax.
#$Web.AllProperties[“__WebTemplates”] = “”
This is how the “New Site” GUI looks after the script.
We just set the Available Templates to “Team Site”, “Blank Site” and “Document Workspace”.
If you have any questions, you can ask in the comments I will answer as fast as possible 🙂