Find All Inactive Features in SharePoint with PowerShell
What is inactive Feature in SharePoint? Well, Features which are installed but not activated anywhere!
Here is the PowerShell script to find inactive features for SharePoint:
Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue
$InactiveFeatures = @()
#Get All installed features on respective scopes
$WebAppFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "WebApplication" }
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Site" }
$WebFeatures = Get-SPFeature| Where-Object {$_.Scope -eq "Web" }
Write-host "Checking Web Application Scoped Features..."
foreach ($WebAppFeature in $WebAppFeatures)
{
$Flag = $False
foreach ($WebApp in Get-SPWebApplication)
{
if ((Get-SPFeature -WebApplication $WebApp.URL | Where-Object {$_.Id -eq $WebAppFeature.id}) -ne $null)
{
#We found that the Feature is active, Lets end up the loop
$Flag = $True
break
}
}
if($Flag -eq $False)
{
Write-Host "$($WebFeature.DisplayName) is not Active on any Web Application!)"
}
}
Write-Host "`nChecking Site Collection Scoped Features..."
foreach ($SiteFeature in $SiteFeatures)
{
$Flag = $False
:WebAppLoop1 foreach ($WebApp in Get-SPWebApplication)
{
foreach($site in $WebApp.Sites)
{
if ((Get-SPFeature -Site $Site.URL | Where-Object {$_.Id -eq $SiteFeature.id}) -ne $null)
{
#We found that the Feature is active, Lets end up the loop
$Flag = $True
break WebAppLoop1
}
}
}
if($Flag -eq $False)
{
Write-Host "$($SiteFeature.DisplayName) is not Active on Any Site Collection!"
}
}
Write-host "`nChecking Web Scoped Feature..."
foreach ($WebFeature in $WebFeatures)
{
$Flag = $False
#I'm limiting to a single web application, Remove ""https://sharepoint.crescent.com" to process all WebApps
:WebAppLoop2 foreach ($WebApp in Get-SPWebApplication "https://sharepoint.crescent.com")
{
foreach($Site in $WebApp.Sites)
{
foreach($Web in $Site.AllWebs)
{
if ((Get-SPFeature -Web $Web.URL | Where-Object {$_.Id -eq $WebFeature.id}) -ne $null)
{
#We found that the Feature is active, Lets end up the loop
$Flag = $True
break WebAppLoop2
}
}
}
}
if($Flag -eq $False)
{
Write-Host "$($WebFeature.DisplayName) is not Active on Any Web!"
}
}
Please note: There could be many OOTB features that stay Inactive based on the site template we use. So, use this script to get an insight into your custom features deployed to the SharePoint 2013/SharePoint 2010 environments.
To get a report on features activated on various scopes, refer: SharePoint Features Usage Report using PowerShell
I am trying to find a script to list ALL active features in each SC and Web in a farm… I need to see each site/web and it’s active features… do you have a script for that?
Hi Rick, Here you go: SharePoint Features Usage Report using PowerShell