Scenario/Problem: You want to create sites under your site collection.
Solution: Use the New-SPWeb cmdlet from the SharePoint 2013 Management Shell.
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>
A few switch parameters are available for 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 only grants the System Account Full Control access.
Listing 1 shows a sample command-line entry for creating a subsite using the Team Site template.
Listing 1. Creating a Subsite in the Root Site Collection
New-SPWeb -url http://sp2013/PSSubSite -name "PS Sub Site"
-template STS#0 -AddToTopNav -UniquePermissions -UseParentTopNav
You can find the site template names using Get-SPWebTemplate.
If no template is provided, the site still is created. In this case,
after the site is accessed via the browser, SharePoint prompts for the
selection of a site template.
Using both AddToTopNav and UseParentTopNav ensures that the new site always appears in the top navigation, as shown in Figure 1.
Figure 1. Using the switch parameters places the subsite in the top nav.