Activate / Deactivate Feature with PowerShell on all site collections of the webapp - Fiks IT

Fiks IT

Everything began from nothing.

Post Top Ad

Responsive Ads Here
Activate / Deactivate Feature with PowerShell on all site collections of the webapp

Activate / Deactivate Feature with PowerShell on all site collections of the webapp

Share This
Hello,


When we do some change on the solution  specially on the branding  for exmple ( display teamplate),we should update also existing sites collection and replace old files with new one after the deployment. So this powershell Script with do this on the all farm.
$feature = Get-SPFeature -Identity "ID OF THE FEATURE"
$siteCollections = Get-SPSite –WebApplication $webhubUrl -Limit ALL
$siteCollections | foreach-object {
   Write-Host "Deactivating" $feature.DisplayName "on" $_.Url -foregroundcolor yellow
   Disable-SPFeature $feature -Url $_.Url -confirm:$false

}
$siteCollections | foreach-object {
  
   Write-Host "Activating" $feature.DisplayName "on" $_.Url -foregroundcolor green
   Enable-SPFeature $feature -Url $_.Url

Featured Post

Machine learning : GridSearch with Cross Validation , Sklearn

Grid Search Method :  This function helps you to get the best Kernel, gamma, C hyperparam to have a good prediction with the SVM algorit...

Post Bottom Ad

Responsive Ads Here

Pages