SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to activate specific feature to all site collection which is inside the particular web application using powershell script?

share|improve this question
up vote 8 down vote accepted

Get-SPWebApplication xxx | Get-SPSite -Limit ALL | % {Enable-SPFeature "xxx" -Url $_.Url}

share|improve this answer
Get-SPWebApplication "Web App URL"| Get-SPSite -Limit ALL | % {Enable-SPFeature "Feature GUID" -Url $_.Url} Is my parameter correct?.I am missing anything? – My Name is Suresh Apr 24 '12 at 14:01
Seems right. Usually I'd use Feature foldername but Guid is OK – Per Jakobsen Apr 24 '12 at 14:29
small tip: use a GUID instead 'name' - it's more precise and less prone to error if there are similar feature names.. – Supriyo SB Chatterjee Apr 24 '12 at 17:59
Name is a lot easier to read and as it ALWAYS are something like Company.Product.Solution[.SubFeature] there will never be a collision. GUID may be a bit faster, but activating/deactivating features using PowerShell is not where you get performance problems – Per Jakobsen Apr 24 '12 at 18:41

Try this,

$site = Get-SPSite http://yourserver

$site | Get-SPWeb -limit all | ForEach-Object {Enable-SPFeature -Identity "FeatureName" -Url $_.Url}


share|improve this answer

Per is spot on with the command, however I was receiving an error "The Feature is not a Farm Level Feature..."

Found the answer at The feature name was different than the name of the wsp that I installed, looking up the name in the 14 hive made it work for me.

Also, I put it into a short script for ready access if I needed it again.

# Enable-SPFeatureOnWebApplication.ps1
# script to turn on a feature on all site collections on a web app
# look-up feature name in 14 hive if not working 

$waURL = "https://your.url"
$featureName = ""

Get-SPWebApplication $waURL | Get-SPSite -Limit ALL | % {Enable-SPFeature $featureName -Url $_.Url}
share|improve this answer

other method:

share|improve this answer
-1 for linking your own (non-English) blog article that contains only one stsadm command that doesn't answer this question (PowerShell command is needed) – Vedran Rasol Apr 24 '12 at 13:57
Thanks for the -1 is right, I was racing and I was hoping it would be useful. – Stefano Paterno Apr 24 '12 at 14:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.