Avatar of chrislindsay
chrislindsay
Flag for United Kingdom of Great Britain and Northern Ireland asked on

How do I export distribution groups and Mail contact to a csv file in Exchange

Hi Guys,

I would like a exchange shell script to help me understand which contacts belong to which distribution list.

Thanks
Exchange

Avatar of undefined
Last Comment
Gareth Gudger

8/22/2022 - Mon
Adam Farage

Get-DistributionGroupMember -Identity <dl_name@company.com> | Select Identity, PrimarySmtpAddress | Export-CSV C:\DistributionGroup.csv
chrislindsay

ASKER
sorry for my ignorance but what do i ender in the <dl_name@company.com> part of the script as all my contacts have different email domains?  Thanks
tshearon

You could do the following:

Get-DistributionGroup “your_distro_name” | Get-DistributionGroupMember | Select Name,RecipientType | export-csv c:\distro_contacts.csv

This will list the members of your desired distribution list and provide their recipient type. Simply filter out every RecipientType except MailContact.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
chrislindsay

ASKER
Hi I would like all the distribution groups returning.....
ASKER CERTIFIED SOLUTION
Gareth Gudger

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
chrislindsay

ASKER
Worked well thanks
Gareth Gudger

Great stuff.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.