Install-SPSolution
在伺服器陣列中部署已安裝的 SharePoint 解決方案。
Syntax
Install-SPSolution
[-Identity] <SPSolutionPipeBind>
[-AllWebApplications]
[-AssignmentCollection <SPAssignmentCollection>]
[-CASPolicies]
[-CompatibilityLevel <String>]
[-Confirm]
[-Force]
[-FullTrustBinDeployment]
[-GACDeployment]
[-Language <UInt32>]
[-Local]
[-Time <String>]
[-WebApplication <SPWebApplicationPipeBind>]
[-WhatIf]
[<CommonParameters>]
Install-SPSolution
[[-Identity] <SPSolutionPipeBind>]
[-AssignmentCollection <SPAssignmentCollection>]
[-Confirm]
[-Language <UInt32>]
[-Synchronize]
[-WhatIf]
[<CommonParameters>]
Description
此 Cmdlet 包含一個以上的參數集。 您可能只使用一個參數集中的參數,但不可以結合不同參數集的參數。 如需如何使用參數集的詳細資訊,請參閱 Cmdlet 參數集 (https://learn.microsoft.com/powershell/scripting/developer/cmdlet/cmdlet-parameter-sets?view=powershell-5.1) 。
Install-SPSolution Cmdlet 會在伺服器陣列中部署已安裝的 SharePoint 解決方案。 使用 Add-SPSolution Cmdlet 在伺服器陣列中安裝 SharePoint 解決方案套件。
如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet。
範例
------------------範例 1------------------
Install-SPSolution -Identity contoso_solution.wsp -GACDeployment
此範例會在伺服器陣列中部署已安裝的 SharePoint 解決方案 contoso_solution.wsp,並指定可對新的 SharePoint 解決方案部署 GAC。
------------------範例 2------------------
Install-SPSolution -Identity contoso_solution.wsp -GACDeployment -CompatibilityLevel {14,15}
此範例會部署已安裝的 SharePoint 解決方案,安裝之前新增的解決方案,這樣就可以在 14 與 15 模式網站集合中都正確使用該解決方案。
參數
-AllWebApplications
指定要對伺服器陣列中的所有 SharePoint Web 應用程式部署新的 SharePoint 解決方案。
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 |
-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 |
-CASPolicies
指定可以為新的 SharePoint 解決方案部署的程式碼存取安全性 (CAS) 原則。
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 |
-CompatibilityLevel
指定是否要將解決方案安裝至以 CompatibilityLevel 為基礎的特定版本目錄中。 若未設定此參數,預設行為是只會將解決方案安裝至以解決方案 cab 檔案的資訊清單中所追蹤之版本為基礎的版本目錄中。
有效值為:
--14
--15
--14,15
Type: | String |
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 |
-Force
強制執行新的 SharePoint 解決方案的部署。
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 |
-FullTrustBinDeployment
指定允許完全信任 Bin 部署。 若完全信任解決方案,則會使用此參數。
Bin 組件是在虛擬伺服器之 Bin 目錄中安裝的組件。 此套件中的組件會具有 DeploymentTarget=WebApplication 屬性集。 如需 Bin 組件的其他資訊,請參閱<組件元素>
Type: | SwitchParameter |
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 |
-GACDeployment
指定可對新的 SharePoint 解決方案部署全域組件快取 (GAC)。
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 |
-Identity
指定要部署的 SharePoint 解決方案。
此值必須是格式為 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID、有效的 SharePoint 解決方案名稱 (例如 SPSolution1),或有效的 SPSolution 物件執行個體。
Type: | SPSolutionPipeBind |
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 |
-Language
指定解決方案語言套件部署時要使用的解決方案語法。 若未指定此參數,則會假設為零 ("0")。 對於適用於所有語言的解決方案,請使用零。
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 |
-Local
在使用中的伺服器上部署解決方案。
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 |
-Synchronize
同步處理本機伺服器陣列中的所有解決方案或指定的解決方案。
Type: | SwitchParameter |
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 |
-Time
指定將部署解決方案的時間。 預設值是立即部署。
此類型必須是有效的 DateTime 值,格式為 2010, 5, 1。
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 |
-WebApplication
為指定的 SharePoint Web 應用程式部署 SharePoint 解決方案。
此值必須為下列格式之一:
--12345678-90ab-cdef-1234-567890bcdefgh 格式的驗證 GUID
--SharePoint Web 應用程式的驗證名稱 (例如 MyOfficeApp1)
--驗證 SPWebApplication 物件的實例。
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 |
-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 |