I am trying to output to a CSV file the list of activate enterprise features in our sites with DisplayName, GUID and Scope as the content that is written to the CSV file.
I have the following Powershell script but it does not output the DisplayName or the Scope or the GUID - it will only output the url and title of the site that the feature is activated on:
$sites = Get-SPSite -Limit All -ErrorAction SilentlyContinue
foreach ($site in $sites)
{
$webs = Get-SPWeb -site $site.Url -Limit ALL -ErrorAction SilentlyContinue
foreach ($web in $webs)
{
$premiumfeatures = Get-SPFeature "SharePoint Server Enterprise Site features" -Web $web.Url -ErrorAction SilentlyContinue | select DisplayName, Scope, ID | Sort -Property Scope,DisplayName | FT -GroupBy Scope DisplayName,Id
foreach ($premiumfeature in $premiumfeatures)
{
$featureEnabled = "Feature Enabled On: " + $web.Url + " " + $web.Title + " " + $premiumfeature.DisplayName
Write-Host $featureEnabled
Add-Content c:\activated_enterprise_features.csv $featureEnabled
}
$web.Dispose()
}
$site.Dispose()
}
How can I output the DisplayName, Scope and ID for a feature to CSV?