Export Distribution List to CSV

This will give you all Distribution Groups on the server. If you want to only get one DG, use -Identity *DG NAME* on the first line of the script.

$Groups=Get-DistributionGroup

$Groups| foreach {

	$GroupName=$_.Name

$Report+=Get-distributionGroupMember -identity $_.identity| select @{Name='Distribution Group'; Expression={[String]::join(";", $GroupName)}}, Name, PrimarySmtpAddress}

$Report| export-csv ".\DGMembers.csv" -notype

Source: http://bit.ly/1g1Oeuz

Comments

comments

Leave a Reply