New-SPSite

在指定的 URL 创建新的网站集。

语法

Default (默认值)

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>]

说明

cmdlet New-SPSite 创建一个新的网站集,其中包含 URL 和 OwnerAlias 参数的 URL 和所有者。 此 cmdlet 可以在使用旧版模板和功能的 SharePoint Server 模式下创建网站集,也可以在使用新版本的模板和功能的 SharePoint Server 模式下创建网站集。

有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet

示例

示例 1

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

此示例在用户 DOMAIN\Jdow 拥有 https://< 网站名称>/sites/test 处创建一个英语网站集。

示例 2

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

此示例创建一个以主机命名的网站集。 由于提供了模板,因此将创建此网站集的根网站。

示例 3

Get-SPWebTemplate | Where{ $_.Title -eq "Team Site" } | ForEach-Object{ New-SPSite https://<site name</sites/test -OwnerAlias DOMAIN\jdow -Template $_ }

此示例使用 "Team Site" Web 模板创建一个网站集。

示例 4

New-SPSite -URL https://webApp/sites/testsite -OwnerAlias "DOMAIN\JDow" -Language 1033 -CompatibilityLevel 14 -Template STS#0

此示例在用户 DOMAIN\Jdow 拥有 https://< 网站名称>/sites/testsite 处使用工作组网站模板创建英语 14 模式网站集

参数

-AdministrationSiteType

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定网站类型。

有效值为 None 或 TentantAdministration 。

参数属性

类型:SPAdministrationSiteType
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-AssignmentCollection

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

管理对象以便正确进行处理。 使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。 通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。 在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。

使用全局参数时,所有对象均包含在全局存储中。 如果未立即使用对象,或未通过使用 Stop-SPAssignment 命令来处理对象,则可能会发生内存不足的情况。

参数属性

类型:SPAssignmentCollection
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-CompatibilityLevel

适用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定创建新 SPSite 对象时要使用的模板版本。

此值为网站集设置初始 CompatibilityLevel 值。

如果不指定此参数,CompatibilityLevel 默认为 Web 应用程序可能的最高版本,具体取决于 SiteCreationMode 设置。

参数属性

类型:Int32
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

执行命令前,看到确认提示。 有关详细信息,请键入以下命令:get-help about_commonparameters

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ContentDatabase

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要在其中创建新网站的内容数据库的名称或 GUID。 如果未指定内容数据库,那么将自动选择网站集。

键入的值必须是有效的数据库名称(格式为 SiteContent1212)或者 GUID(格式为 1234-5678-9807)。

参数属性

类型:SPContentDatabasePipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-CreateFromSiteMaster

适用:SharePoint Server 2016,SharePoint Server 2019

指定是否使用网站母版创建新站点。

有效值为 True 或 False。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Description

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

描述新网站。

如果未指定任何值,该值将留空。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-HostHeaderWebApplication

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定如果提供的 URL 是一个以主机命名的网站集,HostHeaderWebApplication 参数必须是在其中创建此网站集的 Web 应用程序的名称、URL、GUID 或 SPWebApplication 对象。

如果未指定任何值,该值将留空。

键入的值必须是采用如下格式之一的有效名称:

--A WebApplication

--例如, (URL https://server_name)

--GUID (例如,1234-5678-9876-0987)

参数属性

类型:SPWebApplicationPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Language

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定新网站集的语言 ID。

如果未指定语言,那么创建的网站集将采用安装产品时所指定的同一语言。

这必须是有效的语言标识符 ( LCID )。

参数属性

类型:UInt32
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Name

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定新网站集的标题。

如果未指定任何名称,则应用默认名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-OverrideCompatibilityRestriction

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定是否将兼容性限制用于站点。

有效值为 True 或 False。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-OwnerAlias

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定网站所有者的用户登录名。

键入的值必须是有效的用户别名,格式为 Domain\username。

参数属性

类型:SPUserPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-OwnerEmail

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定网站所有者的电子邮件地址。 如果未指定任何值,该值将留空。

类型必须是表单 someone@example.com中的电子邮件地址。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-QuotaTemplate

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定新网站的配额模板。模板必须已经存在。

如果未指定模板,那么将不应用配额。

参数属性

类型:SPQuotaTemplatePipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SecondaryEmail

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定网站第二所有者的电子邮件地址。 如果未指定任何值,该值将留空。

类型必须是电子邮件地址,格式 someone@example.com为 。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SecondaryOwnerAlias

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定网站第二所有者的用户登录凭据。

如果未指定任何值,那么该值留空。

键入的值必须是有效的用户别名,格式为 Domain\username。

参数属性

类型:SPUserPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SiteSubscription

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要获取网站集的网站组。

参数属性

类型:SPSiteSubscriptionPipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Template

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定新网站集的根网站的 Web 模板。

该模板必须已经安装。

如果未指定模板,将不设置模板。

参数属性

类型:SPWebTemplatePipeBind
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Url

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定新网站集使用的 URL。

如果 URL 不是主机标头站点,则 URL 必须以 Web 应用程序 URL 开头。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

显示一条描述命令作用的消息,而不执行命令。 有关详细信息,请键入以下命令:get-help about_commonparameters

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters