Wednesday, August 31, 2016

SharePoint 2013 TIP: How to create a new website using PowerShell

Sometimes it is more convenient to create a new website (or "Web" in Microsoft terminology) via PowerShell rather than using browser-based methods. I don't mean a new "site", which is Microsoft terminology for "site collection."  I mean just a website that is sub to another website or maybe sub to the site collection's root website.  The commandlet for creating new websites is New-SPWeb.


  1. Identify the following key website parameters:
    1. URL of the existing website that you want to us as a container for the new website.  Don't include the final "/" when noting down this URL.
    2. Name of the new website.
    3. Web template to be used for the new website.  These will be in the format "STS#0" or "CMSPUBLISHING#0," and so on.  For a listing of these and their descriptions, see the references below.
  2. Open an elevated SharePoint Management Shell, and then execute the following commandlet:
    New-SPWeb -Identity "[full URL of the new website]" -Template "[templateNameAndID]" -Name "[title of new website]"
  3. That's it.  It will take a minute or two to complete.  You're done.  See the Notes section below for useful additional aspects about this method.


  • In Microsoft terminology, this is the hierarchy of website terms:
    • Web Application
    • Site Collection
    • Web
  • Don't know the template used by an existing website?  Easy PowerShell. Get an instance of the website, and then interrogate its webtemplate property like so:
    $web=Get-SPWeb -Identity "[website core URL]"
    Note that you need to get both the webtemplate and the webtemplateid.  Also, by "core url" I mean the URL without the web page file name or the folder it's located in.
  • If you run the above commandlet to create the new website, the website permissions will be configured to inherit from the parent website.

No comments: