Home > Articles

  • Print
  • + Share This
This chapter is from the book

Create a New Subsite

Solution: Use the New-SPWeb cmdlet from the SharePoint 2010 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.

A sample command-line entry for creating a subsite using the Team Site template is shown in Listing 3.7.

Listing 3.7. Creating a Subsite in the Root Site Collection

New-SPWeb –url http://sp2010/PSSubSite -name "PS Sub Site"
-template STS#0 –AddToTopNav –UniquePermissions -UseParentTopNav

The site template names can be found using Get-SPWebTemplates. If no template is provided, the site will still be created. In this case, once the site is accessed via the browser, SharePoint will prompt for a site template to be selected.

Using both AddToTopNav and UseParentTopNav ensures the new site always appears in the top navigation, as shown in Figure 3.3.

03fig03.jpg

Figure 3.3 Using the switch parameters places the subsite in the top nav.

  • + Share This
  • 🔖 Save To Your Account