Exchange Management Shell – List All Distribution Lists and Members

by Chris Hall/December 1, 2016

The below is a script written to output all Distribution Lists (DL) and DL Members to a CSV File.

Note that the variable set in the first line of the script is the CSV Output Location and you should change the line with ‘RemoteExchange.ps1’ to the location of your Exchange directory.

set-variable -name exportCSVFileLocation -value “C:\temp\Export.csv”
Remove-Item “$exportCSVFileLocation”
echo “”
echo “**********************************************”
echo “Export All Distribution Lists and Users to CSV”
echo “**********************************************”
echo “”
echo “CSV File Output Location: $exportCSVFileLocation”
echo “”
echo “Exporting, Please wait…”
echo “”
. ‘C:\Program Files\Exchange Server\V15\bin\RemoteExchange.ps1’
Connect-ExchangeServer -auto | out-null
foreach ($group in Get-DistributionGroup) { get-distributiongroupmember $group | sort displayname | select-object displayname,recipientType,@{Label=”Group Name”;Expression={“$group”}} | export-csv -append “$exportCSVFileLocation”}
echo “”
echo “Export Complete”
echo “”

← Back to News

Want to say hey or find out more?

If you're part of a small/medium or enterprise level we
can help address your IT Management needs.

Get in touch
View our Services
Make your data
work for you.
Contact Us

+61 438 661 875


Copyright © DataCommand Pty Ltd / Privacy Policy
ABN 98 205 256 068 / ACN 131 977 323