New-SPWebApplication
在本機伺服器陣列內建立新 Web 應用程式。
Syntax
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>]
Description
建立 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 的內部主機標頭和 的 http://www.contoso.com 公用 URL,建立新的 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 的內部主機標頭和 的 https://www.contoso.com 公用 URL,建立已啟用 SSL 的新 Web 應用程式。
------------------範例 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
指定此應用程式集區執行時所用的使用者帳戶。
使用 Cmdlet Get-SPIisWebServicApplicationPool
來使用系統帳戶。
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 參數,將會自動處置這些物件。
使用 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 應用程式啟用 Secure Sockets Layer (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 應用程式使用的自訂服務應用程式 Proxy 群組。 Web 應用程式會使用此 Proxy 群組中的 Proxy 來連線至服務應用程式。 若未指定此參數,就會使用預設的 Proxy 群組。
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 |