Script error when tried to get the sites list where particular feature should be activated
Below is the error . Also want to export results to excel. Please help 
Script error when tried to get the sites list where particular feature should be activated
Below is the error . Also want to export results to excel. Please help 
Hi @sns1
Per my test, you could try the following PowerShell codes to check if feature is activated. Note: Please make sure the feature display name is right.
PowerShell codes:
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$web = Get-SPWebApplication -Identity "web application URL"
Foreach($site in $web.Sites)
{
$feature = Get-SPFeature -Site $site | Where-Object {$_.DisplayName -eq "the feature you want to check"
}
if($feature -ne $null)
{
Write-Host $site.RootWeb.Url " - Activated"
}
if($feature -eq $null)
{
Write-Host $site.RootWeb.Url " - Deavtivated"
}
}

If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hi Casey Young,
Script is working.
Can you please suggest me how to get these results to export to excel?
What and where I have to add respective parameters in the script?
P
7 people are following this question.