Get features list from wsp solution

13/03/2013 23:29

Get feature list from farm solution

$packageName = "sharepointprojectfarm.wsp"
$solId = (Get-SPSolution $packageName).Id
Get-SPFeature | where {$_.solutionId -eq $solId}|select DisplayName, Scope

 

Get feature list from sandbox solution ($SiteUrl is needed and -Sandboxed switch)

$packageName = "sharepointprojectsandbox.wsp"
$SiteUrl = "https://myserver/sitecollection"

$solId = (Get-SPUserSolution $packageName -Site $SiteUrl).SolutionId

Get-SPFeature -Site $SiteUrl -Sandboxed | where {$_.solutionId -eq $solId} | select DisplayName, Id, Scope

 

#List all farm solutions with features (got from: https://bramdejager.wordpress.com/2012/03/13/get-features-grouped-by-solution-package/)
foreach ($grp in Get-SPFeature | Group-Object SolutionId) {
    $sol = Get-SPSolution -Identity $grp.Name -ErrorAction "Continue"
    Write-Host $sol.Name '(ID:' $grp.Name '), Count:' $grp.Count -ForegroundColor Blue
    foreach ($fd in $grp.Group | sort DisplayName ) {
        Write-Host $fd.DisplayName '(' $fd.Scope ')'
    }
    Write-Host
}