Check for empty groups from a given list

I am using this script to export empty groups from a given list , it is working but not giving output in file ,

$groups = get-content “path\grouplist.txt”
foreach($group in $groups){
Get-sADGroup -identity $group -Properties members | where {-not $_.members} | select Name | Export-Csv path\emptygroups.csv –NoTypeInformation
}

Let us know if you are facing any problems with the code and please try to format the code when posting :slight_smile: