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>]

说明

此 cmdlet 包含多个参数集。

您可以只使用来自一个参数集的参数,也可以不合并来自不同参数集的参数。 有关如何使用参数集的详细信息,请参阅 Cmdlet 参数集 https://go.microsoft.com/fwlink/?LinkID=18781

所有参数集都接受 Identity 参数,该参数可以是 SharePoint 功能的相对路径(视为功能名)或功能定义的 GUID。

如果提供了 Identity 参数,相关 cmdlet 将尝试查找给定范围的给定功能定义或实例。 如果未指定参数,那么将返回所有已安装的功能。

Get-SPFeature cmdlet 在每个范围中的行为各不相同,它将返回每个级别已启用的功能。 如果未提供范围,那么将返回所有已安装的功能。

有关 SharePoint 产品Windows PowerShell的权限和最新信息,请参阅 中的https://go.microsoft.com/fwlink/p/?LinkId=251831联机文档。

示例

示例 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 对象上每个唯一启用的功能的名称和标识符 (ID) 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

指定 Web 的 URL 或 GUID。

键入的值必须为有效的 URL,格式为 https://server_name;也可以是 GUID,格式为 1234-5678-9876-0987。

参数属性

类型: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