共用方式為


Install-SPSolution

在伺服器陣列中部署已安裝的 SharePoint 解決方案。

語法

Deploy

Install-SPSolution
    [-Identity] <SPSolutionPipeBind>
    [-AllWebApplications]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-CASPolicies]
    [-CompatibilityLevel <String>]
    [-Confirm]
    [-Force]
    [-FullTrustBinDeployment]
    [-GACDeployment]
    [-Language <UInt32>]
    [-Local]
    [-Time <String>]
    [-WebApplication <SPWebApplicationPipeBind>]
    [-WhatIf]
    [<CommonParameters>]

Synchronize

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 Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要對伺服器陣列中的所有 SharePoint Web 應用程式部署新的 SharePoint 解決方案。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
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 參數,將會自動處置這些物件。

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

參數屬性

類型:SPAssignmentCollection
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-CASPolicies

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

指定可以為新的 SharePoint 解決方案部署的程式碼存取安全性 (CAS) 原則。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-CompatibilityLevel

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定是否要將解決方案安裝至以 CompatibilityLevel 為基礎的特定版本目錄中。 若未設定此參數,預設行為是只會將解決方案安裝至以解決方案 cab 檔案的資訊清單中所追蹤之版本為基礎的版本目錄中。

有效值為:

--14

--15

--14,15

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
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

-Force

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

強制執行新的 SharePoint 解決方案的部署。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-FullTrustBinDeployment

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定允許完全信任 Bin 部署。 若完全信任解決方案,則會使用此參數。

Bin 組件是在虛擬伺服器之 Bin 目錄中安裝的組件。 此套件中的組件會具有 DeploymentTarget=WebApplication 屬性集。 如需 Bin 組件的其他資訊,請參閱<組件元素>

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-GACDeployment

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

指定可對新的 SharePoint 解決方案部署全域組件快取 (GAC)。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Identity

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

指定要部署的 SharePoint 解決方案。

此值必須是格式為 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID、有效的 SharePoint 解決方案名稱 (例如 SPSolution1),或有效的 SPSolution 物件執行個體。

參數屬性

類型:SPSolutionPipeBind
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:1
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False
Synchronize
Position:1
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Language

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

指定解決方案語言套件部署時要使用的解決方案語法。 若未指定此參數,則會假設為零 ("0")。 對於適用於所有語言的解決方案,請使用零。

參數屬性

類型:UInt32
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Local

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

在使用中的伺服器上部署解決方案。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Synchronize

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

同步處理本機伺服器陣列中的所有解決方案或指定的解決方案。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Synchronize
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Time

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

指定將部署解決方案的時間。 預設值是立即部署。

此類型必須是有效的 DateTime 值,格式為 2010, 5, 1。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-WebApplication

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

為指定的 SharePoint Web 應用程式部署 SharePoint 解決方案。

此值必須為下列格式之一:

--12345678-90ab-cdef-1234-567890bcdefgh 格式的驗證 GUID

--SharePoint Web 應用程式的驗證名稱 (例如 MyOfficeApp1)

--驗證 SPWebApplication 對象的實例。

參數屬性

類型:SPWebApplicationPipeBind
預設值:None
支援萬用字元:False
不要顯示:False

參數集

Deploy
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