Redigera

Dela via


New-SPSite

Creates a new site collection at the specified URL.

Syntax

New-SPSite
   [-Url] <String>
   -OwnerAlias <SPUserPipeBind>
   [-AdministrationSiteType <SPAdministrationSiteType>]
   [-AssignmentCollection <SPAssignmentCollection>]
   [-CompatibilityLevel <Int32>]
   [-Confirm]
   [-ContentDatabase <SPContentDatabasePipeBind>]
   [-Description <String>]
   [-HostHeaderWebApplication <SPWebApplicationPipeBind>]
   [-Language <UInt32>]
   [-Name <String>]
   [-OverrideCompatibilityRestriction]
   [-OwnerEmail <String>]
   [-QuotaTemplate <SPQuotaTemplatePipeBind>]
   [-SecondaryEmail <String>]
   [-SecondaryOwnerAlias <SPUserPipeBind>]
   [-SiteSubscription <SPSiteSubscriptionPipeBind>]
   [-Template <SPWebTemplatePipeBind>]
   [-WhatIf]
   [-CreateFromSiteMaster]
   [<CommonParameters>]

Description

The New-SPSite cmdlet creates a new site collection with the URL and owner that the Url and OwnerAlias parameters. This cmdlet can create site collections in either the SharePoint Server mode which uses the legacy versions of templates and features, or can be created in SharePoint Server mode which uses the new versions of templates and features.

For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.

Examples

------------------EXAMPLE 1-----------------------

New-SPSite https://webApp/sites/test -OwnerAlias "DOMAIN\JDoe" -Language 1033 -Template STS#0

This example creates an English site collection at https://<site name>/sites/test that is owned by user DOMAIN\Jdow.

------------------EXAMPLE 2-----------------------

$w = Get-SPWebApplication https://webApp
New-SPSite https://www.contoso.com -OwnerAlias "DOMAIN\jdow" -HostHeaderWebApplication $w -Name "Contoso" -Template STS#0

This example creates a host-named 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 https://<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 https://webApp/sites/testsite -OwnerAlias "DOMAIN\JDow" -Language 1033 -CompatibilityLevel 14 -Template STS#0

This example creates an English 14 mode site collection by using the Team site template at https://<site name>/sites/testsite that is owned by user DOMAIN\Jdow

Parameters

-AdministrationSiteType

Specifies the site type.

Valid values are None or TentantAdministration.

Type:SPAdministrationSiteType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-AssignmentCollection

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.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-CompatibilityLevel

Specifies the version of templates to use when creating a new SPSite object.

This value sets the initial CompatibilityLevel value for the site collection.

When this parameter is not specified, the CompatibilityLevel will default to the highest possible version for the web application depending on the SiteCreationMode setting.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Confirm

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-ContentDatabase

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.

Type:SPContentDatabasePipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-CreateFromSiteMaster

Specifies whether to create a new site using the Site Master.

The valid values are True or False.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Description

Describes the new site.

If no value is specified, the value is left blank.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-HostHeaderWebApplication

Specifies that if the URL provided is to be a host-named site collection, 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:

--A WebApplication

--A URL (for example, https://server_name)

--A GUID (for example, 1234-5678-9876-0987)

Type:SPWebApplicationPipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Language

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).

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Name

Specifies the title of the new site collection.

If no name is specified, the default name is applied.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-OverrideCompatibilityRestriction

Specifies whether to use compatibility restriction for site.

The valid values are True or False.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-OwnerAlias

Specifies the user login name of the site owner.

The type must be a valid user alias, in the form, Domain\username.

Type:SPUserPipeBind
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-OwnerEmail

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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-QuotaTemplate

Specifies the quota template for the new site.The template must exist already.

If no template is specified, no quota is applied.

Type:SPQuotaTemplatePipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SecondaryEmail

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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SecondaryOwnerAlias

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.

Type:SPUserPipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-SiteSubscription

Specifies the Site Group to get site collections.

Type:SPSiteSubscriptionPipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Template

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.

Type:SPWebTemplatePipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Url

Specifies the URL that the new site collection uses.

If the URL is not a host header site, the URL must start with the web application URL.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition