Find SharePoint Features with PowerShell

I was recently asked by a client for a way to find out what features are activated as site and site collection level.

The following PowerShell is the easiest way I know:

if ((Get-PSSnapin -Name "microsoft.sharepoint.powershell" -ErrorAction SilentlyContinue) -eq $null ) {
    Write-Host "Adding SharePoint Snap-in" -ForegroundColor Cyan;
    Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue;
} else {
    Write-Host "SharePoint Snap-in already loaded" -ForegroundColor Green;
}
 
##################################################
Write-Host "Get all features in the farm sorted by DisplayName" -ForegroundColor Cyan;
##################################################
Get-SPFeature | Sort DisplayName;
 
##################################################
Write-Host "Get a site collection and then all the features in the site collection" -ForegroundColor Cyan;
##################################################
Write-Host "List all site collections" -ForegroundColor DarkCyan;
Get-SPSite;
 
Write-Host "Get a specific site collection and show the features" -ForegroundColor DarkCyan;
$siteCollection = Get-SPSite | where { $_.Url -eq "http://vm882/sites/cit"};
Get-SPFeature -Site $siteCollection | Sort DisplayName;
 
##################################################
Write-Host "Get a site and then all the features in the site" -ForegroundColor Cyan;
##################################################
$site = Get-SPWeb -Site $siteCollection | where {$_.Url -eq "http://vm882/sites/cit"};
Get-SPFeature -Web $site | Sort DisplayName; 

Leave a Reply

Your email address will not be published.