[转]SharePoint 2010 Powershell Feature Cmdlets

本文详细介绍了如何使用PowerShell命令行工具管理SharePoint Farm级别的特性,包括列出特性、启用与禁用特性、安装与卸载特性的方法。通过简单的命令,可以轻松地对特性进行操作。

In this installment its time to look at the various cmdlets that have to do with Features. Of course you can look at the UI to do this but its much, much easier to do this powershell and dare I say more fun.

Now keep in mind that this only related to FARM level features, I will cover Sandbox solutions and features next!

Listing features on Farm, Site Collection and Site

The main cmdlet used within powershell to list features is the Get-SPFeature cmdlets. To show all the features on the farm listed by display name and sorted use this:

1Get-SPFeature | Sort -Property DisplayName

To show all the features on the Farm grouped by scope in a table use:

1Get-SPFeature | Sort -Property DisplayName, Scope | FT -GroupBy Scope DisplayName

To see all features for a Web Application:

1Get-SPFeature -WebApplication http://webapplication

To see all features for a Site Collection:

1Get-SPFeature -Site http://sitecollection

To see all features for a Site:

1Get-SPFeature -Web http://siteurl

Remember for some more information relating to the features you can use:

1Get-SPFeature -Web http://siteurl | Format-List

To see all the members that a feature definition has use:

1Get-SPFeature -Web http://siteurl | Get-Member

Enabling and Disabling Features

To disable and enable features is all pretty easy once again using the Disable-SPFeature and Enable-SPFeature cmdlets but there is a trick. You need the name of the feature folder that contains the actual feature not what is displayed in the UI so be careful:

1Enable-SPFeature -Identity "Hold" -URL http://url

You can apply this to any Site and Site Collection scoped features.
Obviously to disable a feature just use the same syntax but with the Disable-Feature cmdlet

1Disable-SPFeature -Identity "Hold" -URL http://url

Remember though that the -Identity is the DisplayName property of the feature, not the text displayed on the UI which is actually retrieved from a resources file.
For example the Document Sets feature looks like below in the SharePoint interface:
But to actually enable it you have to use the following cmdlet:

1Enable-SPFeature -Identity DocumentSet -URL http://url

Installing and Uninstalling Features

Once again this is pretty straight forward and is really made up of only two cmdlets:  Install-SPFeature and  Uninstall-SPFeature
To install a feature you need to specify the name of the folder that your feature contains:
1Install-SPFeature "FeatureFolderName"

To uninstall simply use the same Uninstall-Feature command with the same parameters:

1UnInstall-SPFeature "FeatureFolderName"
 
 
【原文地址:http://www.sharepointanalysthq.com/2010/09/sharepoint-2010-powershell-feature-cmdlets-2/】

转载于:https://www.cnblogs.com/ray-wong/p/3805925.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值