Domanda

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

È stato utile?

Soluzione

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

Altri suggerimenti

Try this,

$site = Get-SPSite http://yourserver

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

$site.Dispose()

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 http://rajeshch999.blogspot.com/2012/07/powerdhell-feature-is-not-farm-level.html. 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 = "your.feature.name"

Get-SPWebApplication $waURL | Get-SPSite -Limit ALL | % {Enable-SPFeature $featureName -Url $_.Url}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top