Exchange 2013, get all DLs with smtp address

Trying to get a list of ALL DLs (DGs) with their respective smtpaddress, don't care about their members.  When I use:

(Get-DistributionGroup "testgroup").emailaddresses | Select smtpaddress | Export-Csv c:\path.csv -NoTypeInformation

I get the results I'm looking for...

"smtpaddress"

"address@company.com"

If I want to get ALL the DLs (DGs), I enter:

(Get-DistributionGroup).emailaddresses | Select smtpaddress | Export-Csv c:\path.csv -NoTypeInformation

I get this...

Warning: By default, only the first 1000 items are returned... blah blah blah.  To return all items, specify "-ResultSize Unlimited".

So I enter...

(Get-DistributionGroup -ResultSize Unlimited).emailaddresses | Select smtpaddress | Export-Csv c:\path.csv -NoTypeInformation

I get no errors, it creates the .csv file but the file is blank.

Thanks,

September 14th, 2015 5:04pm

Why not simplify it and do it this way:

Get-DistributionGroup -ResultSize Unlimited | Select PrimarySmtpAddress | Export-Csv c:\path.csv -NoTypeInformation

Free Windows Admin Tool Kit Click here and download it now
September 14th, 2015 9:04pm

Thanks, sometimes it just takes someone pointing it out.
September 15th, 2015 12:15am

You're welcome.  Happy to have helped!
Free Windows Admin Tool Kit Click here and download it now
September 15th, 2015 1:47am