New-SPSite
在指定的 URL 创建新的网站集。
语法
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
指定网站类型。
有效值为 None 或 TentantAdministration 。
Type: | SPAdministrationSiteType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-AssignmentCollection
管理对象以便正确进行处理。 使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。 通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。 在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。
使用全局参数时,所有对象均包含在全局存储中。
如果未立即使用对象,或未通过使用 Stop-SPAssignment
命令来处理对象,则可能会发生内存不足的情况。
Type: | SPAssignmentCollection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-CompatibilityLevel
指定创建新 SPSite 对象时要使用的模板版本。
此值为网站集设置初始 CompatibilityLevel 值。
如果不指定此参数,CompatibilityLevel 默认为 Web 应用程序可能的最高版本,具体取决于 SiteCreationMode 设置。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Confirm
执行命令前,看到确认提示。
有关详细信息,请键入以下命令: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 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-ContentDatabase
指定要在其中创建新网站的内容数据库的名称或 GUID。 如果未指定内容数据库,那么将自动选择网站集。
键入的值必须是有效的数据库名称(格式为 SiteContent1212)或者 GUID(格式为 1234-5678-9807)。
Type: | SPContentDatabasePipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-CreateFromSiteMaster
指定是否使用网站母版创建新站点。
有效值为 True 或 False。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2016, SharePoint Server 2019 |
-Description
描述新网站。
如果未指定任何值,该值将留空。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-HostHeaderWebApplication
指定如果提供的 URL 是一个以主机命名的网站集,HostHeaderWebApplication 参数必须是在其中创建此网站集的 Web 应用程序的名称、URL、GUID 或 SPWebApplication 对象。
如果未指定任何值,该值将留空。
键入的值必须是采用如下格式之一的有效名称:
--A WebApplication
--URL (例如, https://server_name)
--GUID (例如,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 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Language
指定新网站集的语言 ID。
如果未指定语言,那么创建的网站集将采用安装产品时所指定的同一语言。
这必须是有效的语言标识符 ( LCID )。
Type: | UInt32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Name
指定新网站集的标题。
如果未指定任何名称,则应用默认名称。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-OverrideCompatibilityRestriction
指定是否将兼容性限制用于站点。
有效值为 True 或 False。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-OwnerAlias
指定网站所有者的用户登录名。
键入的值必须是有效的用户别名,格式为 Domain\username。
Type: | SPUserPipeBind |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-OwnerEmail
指定网站所有者的电子邮件地址。 如果未指定任何值,该值将留空。
类型必须是表单 someone@example.com中的电子邮件地址。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-QuotaTemplate
指定新网站的配额模板。模板必须已经存在。
如果未指定模板,那么将不应用配额。
Type: | SPQuotaTemplatePipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-SecondaryEmail
指定网站第二所有者的电子邮件地址。 如果未指定任何值,该值将留空。
类型必须是电子邮件地址,格式 someone@example.com为 。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-SecondaryOwnerAlias
指定网站第二所有者的用户登录凭据。
如果未指定任何值,那么该值留空。
键入的值必须是有效的用户别名,格式为 Domain\username。
Type: | SPUserPipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-SiteSubscription
指定要获取网站集的网站组。
Type: | SPSiteSubscriptionPipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Template
指定新网站集的根网站的 Web 模板。
该模板必须已经安装。
如果未指定模板,将不设置模板。
Type: | SPWebTemplatePipeBind |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Url
指定新网站集使用的 URL。
如果 URL 不是主机标头站点,则 URL 必须以 Web 应用程序 URL 开头。
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-WhatIf
显示一条描述命令作用的消息,而不执行命令。
有关详细信息,请键入以下命令: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 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |