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.
Procedure
- Identify the following key website parameters:
- 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.
- Name of the new website.
- 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.
- 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]"
- 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.
References
- Microsoft TechNet: Windows PowerShell for SharePoint 2013 reference
- Microsoft TechNet Wiki Articles
Notes
- 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.
$web.webtemplate
$web.webtemplateid - If you run the above commandlet to create the new website, the website permissions will be configured to inherit from the parent website.