New-SPWebApplication

 

適用版本: SharePoint Foundation 2010, SharePoint Server 2010

上次修改主題的時間: 2015-03-09

在本機伺服器陣列內建立新 Web 應用程式。

Syntax

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

詳細描述

建立由 Name 參數指定的新 Web 應用程式。由 DatabaseCredentials 參數所指定的使用者必須是資料庫伺服器上 dbcreator 固定伺服器角色的成員。

Parameters

參數 必要 類型 描述

ApplicationPool

必要

System.String

指定要使用的應用程式集區名稱,例如,SharePoint – 1213。如果指定名稱的應用程式集區不存在,則必須提供 ApplicationPoolAccount 參數並建立新應用程式集區。若未指定值,就會使用預設應用程式集區。

Name

必要

System.String

指定新 Web 應用程式的名稱。

AdditionalClaimProvider

選用

Microsoft.SharePoint.PowerShell.SPClaimProviderPipeBind[]

新增特定宣告提供者至定義的 Web 應用程式。

AllowAnonymousAccess

選用

System.Management.Automation.SwitchParameter

允許匿名存取 Web 應用程式。

ApplicationPoolAccount

選用

Microsoft.SharePoint.PowerShell.SPProcessAccountPipeBind

指定此應用程式集區執行時所用的使用者帳戶。使用 Get-SPIisWebServicApplicationPool Cmdlet 可使用系統帳戶。

AssignmentCollection

選用

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

為能適當處置物件而管理物件。使用 SPWebSPSite 等物件可能會耗用大量的記憶體,因此在 Windows PowerShell 指令碼中使用這些物件時,必須適當地管理記憶體。您可以使用 SPAssignment 物件將物件指派給變數,並在不需要時處置這些物件,以釋放記憶體。使用 SPWebSPSiteSPSiteAdministration 物件時,若未使用指派集合或 Global 參數,將會自動處置這些物件。

注意

使用 Global 參數時,所有物件會包含在全域儲存區內。若未立即使用物件,或未使用 Stop-SPAssignment 命令處置物件,將會發生記憶體不足的狀況。

AuthenticationMethod

選用

System.String

使用 KerberosNTLM 來指定驗證方法。若未指定值,則預設會套用 NTLM

AuthenticationProvider

選用

Microsoft.SharePoint.PowerShell.SPAuthenticationProviderPipeBind[]

指定驗證提供者或適用於 Web 應用程式的提供者。

Confirm

選用

System.Management.Automation.SwitchParameter

執行命令之前,會先提示您進行確認。如需詳細資訊,請輸入下列命令:get-help about_commonparameters

DatabaseCredentials

選用

System.Management.Automation.PSCredential

指定資料庫使用者帳戶的 Windows PowerShell Credential 物件。

DatabaseName

選用

System.String

指定新 Web 應用程式之初始內容資料庫的名稱。

此類型必須是有效的資料庫名稱,例如 ContentDB1。若未指定值,就會自動產生格式為 WSS_Content_<GUID> 的值。

DatabaseServer

選用

System.String

指定資料庫伺服器名稱。此類型必須是格式為 SQL1 的有效資料庫伺服器名稱,其中會使用具名執行個體,格式可顯示為 server\server。若未提供值,就會使用預設的 SQL Server 執行個體。

HostHeader

選用

System.String

指定已指派給必須與備用存取對應設定相關聯之 Web 應用程式的有效 URL,格式為 server_name。

HostHeader 參數存在時,此欄位的值為 Web 應用程式的內部 URL。Url 參數係用於指定公用 URL。若未指定值,則此值會保留空白。

Path

選用

System.String

在虛擬目錄資料夾中指定新 Web 應用程式的實體目錄。此類型是格式為 C:\Inutepub\wwwroot\MyWebApplication 的有效路徑。若未指定值,就會套用 %wwwroot%\wss\VirtualDirectories\<portnumber> 值。

Port

選用

System.UInt32

指定存取此 Web 應用程式所在的連接埠。連接埠可以是任何有效的連接埠號碼。若未指定任何連接埠,就會自動產生不衝突的連接埠號碼。

重要

若指定已被指派的連接埠號碼,尚未變更新網站或舊網站的連接埠號碼時,IIS 不會啟動新網站。

SecureSocketsLayer

選用

System.Management.Automation.SwitchParameter

為此 Web 應用程式啟用 Secure Sockets Layer (SSL) 加密。如果選擇使用 SSL,就必須使用 IIS 管理工具在每部伺服器上新增憑證。在此作業完成之前,您無法由此 IIS 網站存取 Web 應用程式。

ServiceApplicationProxyGroup

選用

Microsoft.SharePoint.PowerShell.SPServiceApplicationProxyGroupPipeBind

指定 Web 應用程式要使用的自訂服務應用程式 Proxy 群組。Web 應用程式會使用此 Proxy 群組中的 Proxy 來連線至服務應用程式。若未指定此參數,就會使用預設的 Proxy 群組。

SignInRedirectProvider

選用

Microsoft.SharePoint.PowerShell.SPTrustedIdentityTokenIssuerPipeBind

設定登入重新導向 URL 以指向在特定驗證提供者中所定義的 URL。

SignInRedirectURL

選用

System.String

指定 Web 應用程式的登入重新導向 URL。

Url

選用

System.String

指定 Web 應用程式的負載平衡 URL。

WhatIf

選用

System.Management.Automation.SwitchParameter

顯示訊息描述命令效果,而非描述命令執行的效果。如需詳細資訊,請輸入下列命令:get-help about_commonparameters

輸入類型

傳回類型

Example

------------------範例-----------------------

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

此範例會使用 sharepoint.contoso.com 的內部主機標題與 https://www.contoso.com 的公開 URL 建立新的 Web 應用程式。

See Also

Reference

Get-SPWebApplication
Set-SPWebApplication
Get-SPWebApplication