Archive for June, 2012

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?

Here is a picture of the “New Site” GUI before running the Powershell Script.
New Site Available Templates
Now here is the script.

$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.

New Site Available Templates

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 🙂

No ratings yet.

Please rate this