New-SPWebApplication
在本地服务器场中创建新的 Web 应用程序。
语法
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
向定义的 Web 应用程序添加特定声明提供程序。
Type: | SPClaimProviderPipeBind[] |
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 |
-AllowAnonymousAccess
允许对 Web 应用程序进行匿名访问。
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 |
-ApplicationPool
指定要使用的应用程序池的名称;例如,SharePoint - 1213。 如果不存在具有提供的名称的应用程序池,必须提供 ApplicationPoolAccount 参数,这将创建一个新的应用程序池。 如果未指定任何值,将使用默认应用程序池。
Type: | String |
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 |
-ApplicationPoolAccount
指定将运行此应用程序池的用户帐户的身份。
使用 Get-SPIisWebServicApplicationPool
cmdlet 使用系统帐户。
Type: | SPProcessAccountPipeBind |
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 |
-AuthenticationMethod
使用 Kerberos 或 NTLM 可指定身份验证方法。 如果未指定任何值,则应用默认的 NTLM 。
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 |
-AuthenticationProvider
指定应用于 Web 应用程序的验证提供程序或提供程序。
Type: | SPAuthenticationProviderPipeBind[] |
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 |
-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 |
-DatabaseCredentials
指定数据库用户帐户的 Windows PowerShell Credential 对象。
Type: | PSCredential |
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 |
-DatabaseName
指定新 Web 应用程序的初始内容数据库的名称。
键入的值必须为有效的数据库名称;例如,ContentDB1。 如果未指定任何值,则自动生成格式为 WSS_Content_<GUID> 的值。
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 |
-DatabaseServer
指定数据库服务器名称。 键入的值必须是 SQL1 形式的有效数据库服务器名称;如果使用了命名实例,此格式可显示为 server\server。 如果未提供值,则使用默认 SQL Server 实例。
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 |
-HostHeader
指定分配给必须与备用访问映射配置关联的 Web 应用程序的有效 URL,格式为 server_name。
如果存在 HostHeader 参数,则此字段的值为 Web 应用程序的内部 URL。 Url 参数用于指定公共 URL。如果未指定任何值,则该值留空。
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 |
-Name
指定新 Web 应用程序的名称。
Type: | String |
Position: | Named |
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 |
-Path
指定新 Web 应用程序的物理目录(在虚拟目录文件夹中)。 键入的值为 C:\Inetpub\wwwroot\MyWebApplication 形式的有效路径。 如果未指定任何值,则应用值 %wwwroot%\wss\VirtualDirectories\<portnumber> 。
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 |
-Port
指定可在其上访问此 Web 应用程序的端口。 可以是任意有效端口号。 如果未指定端口,则自动生成一个非冲突的端口号。
如果指定了已分配的端口号,则直到您更改新网站的端口号或旧网站的端口号时,IIS 才会启动新网站。
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 |
-SecureSocketsLayer
对此 Web 应用程序启用安全套接字层 (SSL) 加密。 如果选择使用 SSL,则必须使用 IIS 管理工具在每个服务器中添加证书。 完成此操作之前,将无法从此 IIS 网站访问 Web 应用程序。
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 |
-ServiceApplicationProxyGroup
指定 Web 应用程序要使用的自定义服务应用程序代理组。 Web 应用程序将使用此代理组中的代理来连接服务应用程序。 如果未指定此参数,则使用服务器场的默认代理组。
Type: | SPServiceApplicationProxyGroupPipeBind |
Aliases: | ProxyGroup |
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 |
-SignInRedirectProvider
设置登录重定向 URL,使其指向在指定验证提供程序中定义的 URL。
Type: | SPTrustedIdentityTokenIssuerPipeBind |
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 |
-SignInRedirectURL
指定 Web 应用程序的登录重定向 URL。
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 |
-Url
指定 Web 应用程序的负载平衡 URL。
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 |
-UserSettingsProvider
提供对外部用户设置提供程序的访问权限。
Type: | SPUserSettingsProviderPipeBind |
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 |
-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 |