It's not an uncommon task to want to find out in what webs you have a specific feature enabled. This little script does just that, taking 2 params (site collection url, feature name) and simple output the SharePoint web url. Nothing fancy, but certainly a useful script to have in your toolbox!
A good example of this is where you are using content publishing going from an Enterprise internal farm to a Foundation external farm, certain feature won’t be in the Foundation farm and will cause the Content Publisher to fail, it will be so kind as to tell you what feature is causing the problem, but not where it is! Someone somewhere has enabled a feature they shouldn’t have!!!
I’m sure some “one line wizards” could optimise this script – but that’s not my bag – I’m interested in getting the job done for our clients and providing a useful script we can use again and again.
You could of course add in Disable-SPFeaturecommand if you wanted to do that at the same time…
#Powershell script to identify where in a site collection a specific feature is enabled #Version: 1.0 #Author: Steve Clements | Perspicuity Ltd #Params: #$siteCollectionUrl - url of the site collection #$featureName - name of the feature you want to find param ([string] $siteCollectionUrl, [string] $featureName) if(!$siteCollectionUrl-or!$featureName) { Write-Host-ForegroundColorRed"You must provide a site collection url and feature name to find!" break } Write-Host-BackgroundColorDarkGreen"Feature '"$featureName"' exists in these sites" Get-SPSite$siteCollectionUrl | ForEach-Object { Get-SPWeb-Site$_ | ForEach-Object { $f=Get-SPFeature-Web$_ | Where {$_.DisplayName -eq$featureName} if($f) { Write-Host$_.Url } } } Write-Host-BackgroundColorDarkGreen"Done"