0

Is it possible to deploy & activate a site scoped wsp to every site collection in a Farm?

I have a VS solution scoped to Site. It creates a pre-populated Choice column. I can build the wsp, Add-Solution via PS, Install-SPSolution via PS.

But it only appears on the Central Admin Site Collection features. I need the feature to be installed & activated on every site collection in the farm and across multiple Web Apps.

1 Answer 1

2

try the below script, you have to replace the web application url and feature name below.

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
 $webs =  get-spsite -webapplication "http://www.yoursharepointURL.com"
 $feature = "YourFeatureName" #this might not be what you expect it to be, best to do get-spfeature | Select displayname

  Foreach ($oneweb in $webs)
  {
    write-host $oneweb
    $siteFeature = get-spfeature -site $oneweb | Where {$_.displayname -eq $feature}
    if ($siteFeature -eq $null)
    {
      Write-Host "Activating Site level Features at $oneweb" -foregroundcolor Yellow
      Enable-SPFeature -Identity $Feature -URL $oneweb.URL -Confirm:$False
    }
    else
    {
      Write-Host "Feature $feature is already activated on $oneweb" -foregroundcolor green
    }
  }

Read more here: POWERSHELL TO ACTIVATE A SHAREPOINT 2010 FEATURE ON EVERY SITE COLLECTION IN A WEB APP

1
  • Thanks for this. I can do this, I didn't think of the option of doing it via PS. I thought I was missing some config in Visual Studio
    – nerz
    Mar 6, 2017 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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