15 49.0138 8.38624 1 0 4000 1 https://vladtalkstech.com 300 1
theme-sticky-logo-alt

Restrict the New Site Available Templates with Powershell

2 Comments

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”] = “”
$Web.Update()

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 🙂

Next Post
Create a SharePoint Site Collection with a custom Template using Powershell

2 Comments

  • October 22, 2014 at 12:01 am
    SImon

    This is great, and i know it was posted a long time ago, but i am getting an error with $web.update()… aparrently its null after running this script, any ideas?

    Reply
    • January 26, 2015 at 7:08 pm

      try something like this:
      $mainurl = “http://vlad.test.loc”
      $Web = Get-SPWeb $mainurl
      $Web.AllProperties[“__WebTemplates”] = “STS#0“
      $Web.Update()

      Reply

Leave a Reply