0

I've been tasked with getting a list of all members for a list of 500+ distribution lists (DLs). I currently have the list (of DLs) in an excel/csv that basically lists the names and primary smtp addresses of the DL's I need to get the members for.

My question is, is there a way using Exchange Shell to get the members of each DL listed and then output to a new (single) file with all of the DL's and the members per each DL?

Any help would be GREATLY appreciated!

N00bAdmin
  • 21
  • 1
  • 2

1 Answers1

0

A very basic example:

$lines = get-content groupList.txt

foreach ($line in $lines)
{
add-content -path memberList.txt "Group: $line"
$members = get-adgroupmember $line
foreach ($member in $members)
{ add-content -path memberList.txt "$member" }
}
smwk
  • 570
  • 2
  • 5
  • 14