New-SPWebApplication

在本地服务器场中创建新的 Web 应用程序。

语法

Default (默认值)

New-SPWebApplication
    -ApplicationPool <String>
    -Name <String>
    [-AdditionalClaimProvider <SPClaimProviderPipeBind[]>]
    [-AllowAnonymousAccess]
    [-ApplicationPoolAccount <SPProcessAccountPipeBind>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-AuthenticationMethod <String>]
    [-AuthenticationProvider <SPAuthenticationProviderPipeBind[]>]
    [-Confirm]
    [-DatabaseCredentials <PSCredential>]
    [-DatabaseName <String>]
    [-DatabaseServer <String>]
    [-HostHeader <String>]
    [-Path <String>]
    [-Port <UInt32>]
    [-SecureSocketsLayer]
    [-ServiceApplicationProxyGroup <SPServiceApplicationProxyGroupPipeBind>]
    [-SignInRedirectProvider <SPTrustedIdentityTokenIssuerPipeBind>]
    [-SignInRedirectURL <String>]
    [-Url <String>]
    [-UserSettingsProvider <SPUserSettingsProviderPipeBind>]
    [-WhatIf]
    [<CommonParameters>]

说明

创建由 Name 参数指定的新 Web 应用程序。 DatabaseCredentials 参数指定的用户必须是数据库服务器上 dbcreator 固定服务器角色的成员。

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

示例

示例 1

New-SPWebApplication -Name "Contoso Internet Site" -Port 80 -HostHeader sharepoint.contoso.com -URL "http://www.contoso.com" -ApplicationPool "ContosoAppPool" -ApplicationPoolAccount (Get-SPManagedAccount "DOMAIN\wa")

此示例使用 sharepoint.contoso.com 的内部主机标头和 公共 URL http://www.contoso.com创建新的 Web 应用程序。

示例 2

New-SPWebApplication -Name "Contoso Internet Site" -Port 443 -SecureSocketsLayer -HostHeader sharepoint.contoso.com -URL "https://www.contoso.com:443" -ApplicationPool "ContosoAppPool" -ApplicationPoolAccount (Get-SPManagedAccount "DOMAIN\wa")

此示例使用 sharepoint.contoso.com 的内部主机标头和 公共 URL 创建新的启用了 SSL 的 https://www.contoso.comWeb 应用程序。

示例 3

$ap = New-SPAuthenticationProvider
New-SPWebApplication -Name "Contoso Internet Site" -URL "https://www.contoso.com"  -Port 443
-ApplicationPool "ContosoAppPool"
-ApplicationPoolAccount (Get-SPManagedAccount "DOMAIN\wa")
-AuthenticationProvider $ap -SecureSocketsLayer

使用域帐户域\wa 在 URL https://www.contoso.com 上创建 Windows 声明 Web 应用程序。

参数

-AdditionalClaimProvider

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

向定义的 Web 应用程序添加特定声明提供程序。

参数属性

类型:

SPClaimProviderPipeBind[]

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

参数集

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

-AllowAnonymousAccess

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

允许对 Web 应用程序进行匿名访问。

参数属性

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

参数集

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

-ApplicationPool

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

指定要使用的应用程序池的名称;例如,SharePoint - 1213。 如果不存在具有提供的名称的应用程序池,必须提供 ApplicationPoolAccount 参数,这将创建一个新的应用程序池。 如果未指定任何值,将使用默认应用程序池。

参数属性

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

参数集

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

-ApplicationPoolAccount

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

指定将运行此应用程序池的用户帐户的身份。 使用 Get-SPIisWebServicApplicationPool cmdlet 使用系统帐户。

参数属性

类型:SPProcessAccountPipeBind
默认值: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

-AuthenticationMethod

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

使用 Kerberos 或 NTLM 可指定身份验证方法。 如果未指定任何值,则应用默认的 NTLM 。

参数属性

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

参数集

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

-AuthenticationProvider

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

指定应用于 Web 应用程序的验证提供程序或提供程序。

参数属性

类型:

SPAuthenticationProviderPipeBind[]

默认值: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

-DatabaseCredentials

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

指定数据库用户帐户的 Windows PowerShell Credential 对象。

参数属性

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

参数集

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

-DatabaseName

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

指定新 Web 应用程序的初始内容数据库的名称。

键入的值必须为有效的数据库名称;例如,ContentDB1。 如果未指定任何值,则自动生成格式为 WSS_Content_<GUID> 的值。

参数属性

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

参数集

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

-DatabaseServer

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

指定数据库服务器名称。 键入的值必须是 SQL1 形式的有效数据库服务器名称;如果使用了命名实例,此格式可显示为 server\server。 如果未提供值,则使用默认 SQL Server 实例。

参数属性

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

参数集

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

-HostHeader

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

指定分配给必须与备用访问映射配置关联的 Web 应用程序的有效 URL,格式为 server_name。

如果存在 HostHeader 参数,则此字段的值为 Web 应用程序的内部 URL。 Url 参数用于指定公共 URL。如果未指定任何值,则该值留空。

参数属性

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

参数集

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

-Name

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

指定新 Web 应用程序的名称。

参数属性

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

参数集

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

-Path

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

指定新 Web 应用程序的物理目录(在虚拟目录文件夹中)。 键入的值为 C:\Inetpub\wwwroot\MyWebApplication 形式的有效路径。 如果未指定任何值,则应用值 %wwwroot%\wss\VirtualDirectories\<portnumber> 。

参数属性

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

参数集

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

-Port

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

指定可在其上访问此 Web 应用程序的端口。 可以是任意有效端口号。 如果未指定端口,则自动生成一个非冲突的端口号。

如果指定了已分配的端口号,则直到您更改新网站的端口号或旧网站的端口号时,IIS 才会启动新网站。

参数属性

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

参数集

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

-SecureSocketsLayer

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

对此 Web 应用程序启用安全套接字层 (SSL) 加密。 如果选择使用 SSL,则必须使用 IIS 管理工具在每个服务器中添加证书。 完成此操作之前,将无法从此 IIS 网站访问 Web 应用程序。

参数属性

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

参数集

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

-ServiceApplicationProxyGroup

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

指定 Web 应用程序要使用的自定义服务应用程序代理组。 Web 应用程序将使用此代理组中的代理来连接服务应用程序。 如果未指定此参数,则使用服务器场的默认代理组。

参数属性

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

参数集

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

-SignInRedirectProvider

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

设置登录重定向 URL,使其指向在指定验证提供程序中定义的 URL。

参数属性

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

参数集

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

-SignInRedirectURL

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

指定 Web 应用程序的登录重定向 URL。

参数属性

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

参数集

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

-Url

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

指定 Web 应用程序的负载平衡 URL。

参数属性

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

参数集

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

-UserSettingsProvider

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

提供对外部用户设置提供程序的访问权限。

参数属性

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

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):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