Sunday, February 21, 2016

Create Site Collection in SharePoint using PowerShell

We have to use New-SPSite cmdlet to create a site collection in SharePoint. It takes URL and Owner parameters as mandatory with several other parameters. Here is an example:

PowerShell to create new Site Collection in SharePoint 2016:
To create a site collection using PowerShell in SharePoint 2013, use this script.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Variables
$SiteCollURL = "http://intranet.crescent.com/sites/Sales"
$SiteName = "Sales Team Site"
$SiteOwner = "Crescent\Salaudeen"
$SiteTemplate = "STS#0"  #Team Site Template

#Create new Site Collection
New-SPSite -URL $SiteCollURL -OwnerAlias $SiteOwner -Template $SiteTemplate -Name $SiteName


Create blank site collection in SharePoint 2013 using PowerShell 
Use the  template as "STS#1" to create a blank site collection in SharePoint. We can get all available site templates using cmdlet: Get-SPWebTemplates.

SharePoint 2013: PowerShell to create site collection in specific content database
Use -ContentDatabase parameter in New-SPSite to create your new site collection in an existing content database. E.g.
New-SPSite -Name "Sales" -ContentDatabase SP2013_Sales_Content -url http://Intranet.crescent.com/sites/Sales/ -OwnerAlias "Crescent\SPAdmin" -Template "STS#1"

PowerShell to create site collection without template:
In case, you don't provide template value, still the site collection will be created, but when the site is accessed for the first time,  Users will get a prompt to choose the template for the site collection.
Create Site Collection in SharePoint using PowerShell



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...