New-SPSite
Published: July 16, 2012
Applies to: SharePoint Foundation 2013 | SharePoint Server 2013 Enterprise
Creates a new site collection at the specified URL.
New-SPSite [-Url] <String> -OwnerAlias <SPUserPipeBind> [-AdministrationSiteType <None | TenantAdministration>] [-AssignmentCollection <SPAssignmentCollection>] [-CompatibilityLevel <Int32>] [-Confirm [<SwitchParameter>]] [-ContentDatabase <SPContentDatabasePipeBind>] [-Description <String>] [-HostHeaderWebApplication <SPWebApplicationPipeBind>] [-Language <UInt32>] [-Name <String>] [-OverrideCompatibilityRestriction <SwitchParameter>] [-OwnerEmail <String>] [-QuotaTemplate <SPQuotaTemplatePipeBind>] [-SecondaryEmail <String>] [-SecondaryOwnerAlias <SPUserPipeBind>] [-SiteSubscription <SPSiteSubscriptionPipeBind>] [-Template <SPWebTemplatePipeBind>] [-WhatIf [<SwitchParameter>]]
Parameters
| Parameter | Required | Type | Description | ||
|---|---|---|---|---|---|
| Url | Required | System.String | Specifies the URL that the new site collection uses. If the URL is not a host header site, the URL must start with the the web application URL. | ||
| OwnerAlias | Required | System.String | Specifies the user login name of the site owner. The type must be a valid user alias, in the form, Domain\username. | ||
| AdministrationSiteType | Optional | Microsoft.SharePoint.SPAdministrationSiteType | Specifies the site type. Valid values are None or TentantAdministration. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
| ||
| CompatibilityLevel | Optional | System.Int32 | Specifies the version of templates to use when creating a new SPSite object. This value sets the initial CompatibilityLevel value for the site collection. The values for this parameter can be either 14 for SharePoint Server 2010 experience sites or 15 for SharePoint Server 2013 experience sites . When this parameter is not specified, the CompatibilityLevel will default to the highest possible version for the web application depending on the CompatibilityRange setting. | ||
| Confirm | Optional | System.Management.Automation.SwitchParameter | Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters | ||
| ContentDatabase | Optional | Microsoft.SharePoint.PowerShell.SPContentDatabasePipeBind | Specifies the name or GUID of the content database in which to create the new site. If no content database is specified, the site collection is selected automatically. The type must be a valid database name in the form, SiteContent1212, or a GUID in the form, 1234-5678-9807. | ||
| Description | Optional | System.String | Describes the new site. If no value is specified, the value is left blank. | ||
| HostHeaderWebApplication | Optional | Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind | Specifies that if the URL provided is a host header, the HostHeaderWebApplication parameter must be the name, URL, GUID, or SPWebApplication object for the web application in which this site collection is created. If no value is specified, the value is left blank. The type must be a valid name in one of the following forms:
| ||
| Language | Optional | System.Int32 | Specifies the language ID for the new site collection. If no language is specified, the site collection is created with the same language that was specified when the product was installed. This must be a valid language identifier (LCID). | ||
| Name | Optional | System.String | Specifies the title of the new site collection. If no name is specified, the default name is applied. | ||
| OverrideCompatibilityRestriction | Optional | System.Management.Automation.SwitchParameter | |||
| OwnerEmail | Optional | System.String | Specifies the email address of site owner. If no value is specified, the value is left blank. The type must be a email address in the form, someone@example.com. | ||
| QuotaTemplate | Optional | Microsoft.SharePoint.PowerShell.SPQuotaTemplatePipeBind | Specifies the quota template for the new site. The template must exist already. If no template is specified, no quota is applied. | ||
| SecondaryEmail | Optional | System.String | Specifies the email address of the secondary site owner. If no value is specified, the value is left blank. The type must be a email address, in the form, someone@example.com. | ||
| SecondaryOwnerAlias | Optional | System.String | Specifies the user login credentials of the secondary site owner. If no value is specified, the value is left blank. The type must be a valid user alias, in the form, Domain\username. | ||
| SiteSubscription | Optional | Microsoft.SharePoint.PowerShell.SPSiteSubscriptionPipeBind | Specifies the Site Group to get site collections. | ||
| Template | Optional | Microsoft.SharePoint.PowerShell.SPWebTemplatePipeBind | Specifies the Web template for the root web of the new site collection. The template must be already installed. If no template is specified, no template is provisioned. | ||
| WhatIf | Optional | System.Management.Automation.SwitchParameter | Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters |
Detailed Description
The New-SPSite cmdlet creates a new site collection with the URL and owner that the Url and OwnerAlias parameters. specify This cmdlet can create site collections in either the SharePoint Server 2010 mode which uses the legacy 2010 versions of templates and features, or can be created in SharePoint Server 2013 mode which uses the new versions of templates and features.
Input Types
Return Types
------------------EXAMPLE 1-----------------------
New-SPSite http://<site name>/sites/test -OwnerAlias "DOMAIN\JDoe" –Language 1033
This example creates an English site collection at http://<site name>/sites/test that is owned by user DOMAIN\Jdow.
------------------EXAMPLE 2-----------------------
$w = Get-SPWebApplication http://<site name>
New-SPSite http://www.contoso.com -OwnerAlias "DOMAIN\jdow" -HostHeaderWebApplication $w -Name "Contoso" -Template "STS#0"
This example creates a host header site collection. Because the template is provided, the root web of this site collection will be created.
------------------EXAMPLE 3-----------------------
Get-SPWebTemplate | Where{ $_.Title -eq "Team Site" } | ForEach-Object{ New-SPSite http://<site name</sites/test -OwnerAlias DOMAIN\jdow -Template $_ }
This example creates a site collection by using the "Team Site" Web template.
------------------EXAMPLE 4-----------------------
New-SPSite -URL http://<site name>/sites/testsite -OwnerAlias "DOMAIN\JDow" –Language 1033 -CompatibilityLevel 14
This example creates an English 14 mode site collection by using the Team site template at http://<site name>/sites/testsite that is owned by user DOMAIN\Jdow
Change History
| Date | Description |
|---|---|
| July 16, 2012 | Initial publication |

Note: