Scenario/Problem: You need to create a new site collection.
Solution: Use the New-SPSite
cmdlet.
To add a new site collection, use the New-SPSite
cmdlet as follows:
New-SPSite -url <full url of new site collection>
-name <name of new site collection>
-owneralias <site collection administrator>
-template <site collection template to use>
Listing 8.7 shows a sample command-line entry for creating the root site collection using the Team Site template.
New-SPSite -url http://sp2013/sites/sitecol -name Home
-owneralias SPSiteAdmin -template STS#0
The site template names can be found using Get-SPWebTemplate
. If no template is provided, the site collection will still be created. In this case, after the site is accessed via the browser, SharePoint prompts for a site collection template to be selected.
Creating a new site collection using the New-SPSite
cmdlet might take a few minutes. Afterward the new URL is presented.
Tip
You can only create one site collection at the root of the web application. Subsequent site collections must be created using a managed path. See Chapter 4, “Farm Management,” for more information on creating a managed path.
3.16.54.63