Create SharePoint Site Collection using PowerShell New-SPSite


Posted on : Thu, 22nd Oct 15 05:21 pm (Updated on : Thu, 22nd Oct 15 05:21 pm) UTC
Author : Code2care
2314 votes

PowerShell script to create SharePoint Site Collection

Make sure you open SharePoint Management Shell using 'Run as Administrator'.

Name : Create SharePoint Site Collection using PowerShell
  
$siteURL = "http://sharepointsite/sitecoll2"
$sitePrimaryOwner = "domain\username"
$siteSecondaryOwner = "domain\username"
$siteName = "Site Collection 2"
$siteTemplate = "STS#0"
$siteDescription = "This is a site created using PowerShell command"

New-SPSite -Url $siteURL -OwnerAlias $sitePrimaryOwner -SecondaryOwnerAlias $siteSecondaryOwner 
-siteName $siteName -Template $siteTemplate -Description $siteDescription
  

Parameters/Attributes used in this command -

-Url - The URL of the site collection to be created
-OwnerAlias - The Primary owner for this site collection
-SecondaryOwnerAlias - The Secondary owner for this site collection
-siteName - The Name of the site collection to be created
-Template - The Template of the site collection to be created
-Description - The Description of the site collection to be created

List of default site templates can be found from Microsoft TechNet. Here is a list for SharePoint 2010 - http://social.technet.microsoft.com/wiki/contents/articles/20100.sharepoint-2010-default-site-templates.aspx

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +