Thursday, June 20, 2013

Activate Publishing feature at all site collection through powershell

$feature = Get-SPFeature PublishingSite
$siteCollections = Get-SPSite –WebApplication http://sp2010
$siteCollections | foreach-object {
   Write-Host "Activating" $feature.DisplayName "on" $_.Url
   Enable-SPFeature $feature -Url $_.Url
}