- If you install a feature with powershell, you can run the following Windows PowerShell command:
Install-SPFeature FeatureFolderName
- To activate a feature:
Enable-SPFeature FeatureFolderName -Url http://server/site/subsite
- To deactivate a feature:
Disable-SPFeature FeatureFolderName -Url http://server/site/subsite
- To uninstall a feature:
Uninstall-SPFeature FeatureFolderName
- Examples:
Activate site collection feature
$site = Get-SPSite http://sp2010
Enable-SPFeature -Identity “FeatureName” -Url $site.Url
$site.Dispose()
Enable-SPFeature -Identity “FeatureName” -Url $site.Url
$site.Dispose()
Activate site feature
$web = Get-SPWeb http://sp2010
Enable-SPFeature -Identity “FeatureName” -Url $web.Url
$web.Dispose()
Enable-SPFeature -Identity “FeatureName” -Url $web.Url
$web.Dispose()
Activate site collection features for all site collections in a Web Application
$webApp = Get-SPWebApplication -Identity http://sp2010
$webApp | Get-SPSite -limit all | ForEach-Object {Enable-SPFeature -Identity “FeatureName” -Url $_.Url}
$webApp | Get-SPSite -limit all | ForEach-Object {Enable-SPFeature -Identity “FeatureName” -Url $_.Url}

No comments:
Post a Comment