Get-SPFeature

根據指定範圍傳回 SharePoint 功能。

語法

FarmFeatures

Get-SPFeature
    [[-Identity] <SPFeatureDefinitionPipeBind>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Farm]
    [-Limit <String>]
    [<CommonParameters>]

SiteFeatures

Get-SPFeature
    [[-Identity] <SPFeatureDefinitionPipeBind>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Limit <String>]
    [-Site <SPSitePipeBind>]
    [-Sandboxed]
    [<CommonParameters>]

WebFeatures

Get-SPFeature
    [[-Identity] <SPFeatureDefinitionPipeBind>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Limit <String>]
    [-Web <SPWebPipeBind>]
    [<CommonParameters>]

WebApplicationFeatures

Get-SPFeature
    [[-Identity] <SPFeatureDefinitionPipeBind>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Limit <String>]
    [-WebApplication <SPWebApplicationPipeBind>]
    [<CommonParameters>]

FarmFeatureDefinitions

Get-SPFeature
    [[-Identity] <SPFeatureDefinitionPipeBind>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Limit <String>]
    [-CompatibilityLevel <Int32>]
    [<CommonParameters>]

Description

此 Cmdlet 包含一個以上的參數集。

您可能只使用一個參數集中的參數,但不可以結合不同參數集的參數。 如需有關如何使用參數集的詳細資訊,請參閱 Cmdlet 參數集 https://go.microsoft.com/fwlink/?LinkID=18781。

所有參數集都採用 Identity 參數,這可以是 SharePoint 功能的相對路徑, (被視為功能名稱) 或功能定義的 GUID。

如果提供了 Identity 參數,Cmdlet 會嘗試尋找指定範圍的指定功能定義或實例。 如果未指定任何參數,則會傳回所有已安裝的功能。

Get-SPFeature Cmdlet 在每個範圍的行為不同,會在每個層級傳回已啟用的功能。 如果未提供範圍,則會傳回所有已安裝的功能。

如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet。

範例

範例 1

Get-SPFeature -Limit ALL | Where-Object {$_.Scope -eq "SITE"}

此範例會傳回所有已安裝的 SITE 範圍功能的清單。

範例 2

Get-SPSite https://somesite | Get-SPWeb -Limit ALL |%{ Get-SPFeature -Web $_ } | Select DisplayName,ID -Unique

此範例會傳回網站集合中每個 SPWeb 物件上每個唯一啟用功能的名稱和識別碼 (識別碼) https://somesite.

參數

-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

-CompatibilityLevel

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

指定在建立新 SPSite 物件時,所要使用的範本版本。 此值會設定網站集合的初始 CompatibilityLevel 值。 未指定此參數時,CompatibilityLevel 會預設為 Web 應用程式的最高可能版本,視 CompatibilityRange 設定而定。

參數屬性

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

參數集

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

-Farm

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

指定使用此參數時,只顯示已啟用的伺服器陣列功能。

參數屬性

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

參數集

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

-Identity

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

指定要擷取的功能名稱。

類型必須是要取得的功能的完整或部分名稱(格式為 Feature1),或 GUID(格式為 1234-4567-9879)。

參數屬性

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

參數集

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

-Limit

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

限制顯示結果。 若指定「All」,即顯示所有功能。

此類型必須是大於 0 的有效數字。 預設值為 200。

參數屬性

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

參數集

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

-Sandboxed

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

指定擷取沙箱功能。

參數屬性

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

參數集

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

-Site

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

指定已啟用功能取得來源的網站集合名稱。

此類型必須是網站集合的有效 URL,格式為 https://server_name。

參數屬性

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

參數集

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

-Web

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

指定網路的 URL 或 GUID。

此類型必須是格式為 https://server_name 的有效 URL,或格式為 1234-5678-9876-0987 的 GUID。

參數屬性

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

參數集

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

-WebApplication

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

指定已啟用功能取得來源的 Web 應用程式名稱。

此類型必須是 Web 應用程式的有效 URL,格式為 https://server_name。

參數屬性

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

參數集

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

CommonParameters

此 Cmdlet 支援常見參數: -Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。