Ny way to list distribution groups and members

active-directory

I would like to get a list of distribution groups and their members, and possibly output to an excel spreadsheet. Has anyone tried this before or have any ideas where I should start?

Best Answer

In PowerShell:

Import-Module ActiveDirectory

$Groups = Get-ADGroup -Filter {GroupCategory -eq "Distribution"} -Properties Members

ForEach ($g in $Groups) {
    Write-Host $g.name
    Write-Host $g.members `n

}

That will write the output to the console. You can play around with Export-CSV and the other usual suspects to get it into the final format that you want.