kwizcom banner advertisement

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
Please note, the PowerShell ways of creating site collections or subsites using New-SPSite or New-SPWeb doesn't create default user groups! Here is how you can create default user groups in SharePoint: How to Create default user groups in SharePoint
Create Site Collection in SharePoint using PowerShell Create Site Collection in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 8:24 PM Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.