We are making a move from Reddfish Listserver (horrible - don't even Google it) to Mailman. Reddfish "integrated" with Exchange by working with AD groups and contact types. During this migration, I have to get the current lists into mailman which means I have to get a nice clean list of line seperated email addresses to feed into Mailman. Here is the code I use to get this to work. Very simple, but I hope it still proves useful.
add-pssnapin -erroraction silentlycontinue Microsoft.Exchange.Management.Powershell.Admin $listname = 'You List Name Here' $filename = "c:\\$listname.txt" $listmembers = get-distributiongroupmember $listname foreach ($member in $listmembers) { write-output $member.primarysmtpaddress.toString() >> "$filename" }
