Scenario/Problem: You want to create sites under your site collection.
Solution: Use the New-SPWeb
cmdlet.
To add a new subsite, use the New-SPWeb
cmdlet as follows:
New-SPWeb -url <full url of new site> -name <name of new site>
-template <site template to use>
The following switch parameters are available when using the New-SPWeb
cmdlet:
• AddToTopNav
• UniquePermissions
• UseParentTopNav
The AddToTopNav
switch parameter places the new site within the top navigation of the site collection. Using the UseParentTopNav
switch parameter replicates the top nav of the site collection onto the new subsite. Creating a site with UniquePermissions
forces the site to not inherit permissions from the site collection and grants only the System Account Full Control access.
Listing 8.10 shows a sample command-line entry for creating a subsite using the Team Site template.
New-SPWeb -url http://sp2013/sites/sitecol/newsubsite
-name "New Sub Site" -template STS#0 -AddToTopNav -UniquePermissions
-UseParentTopNav
The site template names can be found using Get-SPWebTemplate
. If no template is provided, the site still is created. In this case, when the site is accessed via the browser, SharePoint prompts for a site template to be selected.
18.218.234.83