Wednesday, February 10, 2016

Get all sites where a feature is activated or deactivated

Get list of webs where either feature activated or deactivated in SharePoint at different scopes like web, site collection, web application and farm.

Below PowerShell script will provide list of webs(sub site including top level site) where specified feature is installed and not activated in particular site collection

Get-SPSite "http://kmsnet:5050"| Get-SPWeb -Limit All | Where-Object { (Get-SPFeature "12f73b57-1db8-4272-3d45-d8c1cc9f3d41" -ErrorAction SilentlyContinue -Web $_.Url) -eq $null} | Select Url


Below script will provide list of webs(sub sites including toplevel site) where specified feature is installed and activated.

Get-SPSite "http://kmsnet:5050"| Get-SPWeb -Limit All | Where-Object { (Get-SPFeature "12f73b57-1db8-4272-3d45-d8c1cc9f3d41" -ErrorAction SilentlyContinue -Web $_.Url) -ne $null} | Select Url

Note: If the feature object is null then those web(s) considered that feature is installed and not activated. If it is not-null then feature is installed and activated on the web.

Below PowerShell script will provide list of webs(sub sites including top level site) where specified feature is installed and not activated in all site collections from current SharePoint Farm

Get-SPSite –Limit All | Get-SPWeb -Limit All | Where-Object { (Get-SPFeature "12f73b57-1db8-4272-3d45-d8c1cc9f3d41" -ErrorAction SilentlyContinue -Web $_.Url) -eq $null} | Select Url


Below script will provide list of webs(sub sites including toplevel site) where specified feature is installed and activated in all site collections from current SharePoint Farm.

Get-SPSite –Limit All | Get-SPWeb -Limit All | Where-Object { (Get-SPFeature "12f73b57-1db8-4272-3d45-d8c1cc9f3d41" -ErrorAction SilentlyContinue -Web $_.Url) -ne $null} | Select Url

Below PowerShell script will provide list of webs(sub sites including top level site) where specified feature is installed and not activated in all site collections from specified web application

Get-SPWebApplication “http://kmsnet:5050” |Get-SPSite –Limit All | Get-SPWeb -Limit All | Where-Object { (Get-SPFeature "12f73b57-1db8-4272-3d45-d8c1cc9f3d41" -ErrorAction SilentlyContinue -Web $_.Url) -eq $null} | Select Url

Below script will provide list of webs(sub sites including toplevel site) where specified feature is installed and activated in all site collections from specified web application.

Get-SPWebApplication “http://kmsnet:5050” |Get-SPSite –Limit All | Get-SPWeb -Limit All | Where-Object { (Get-SPFeature "12f73b57-1db8-4272-3d45-d8c1cc9f3d41" -ErrorAction SilentlyContinue -Web $_.Url) -ne $null} | Select Url