Solved

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

Posted on 2014-11-07
7
91 Views
Last Modified: 2014-11-12
Hi Guys,

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

Thanks
0
Comment
Question by:chrislindsay
7 Comments
 
LVL 19

Expert Comment

by:Adam Farage
ID: 40428108
Get-DistributionGroupMember -Identity <dl_name@company.com> | Select Identity, PrimarySmtpAddress | Export-CSV C:\DistributionGroup.csv
0
 

Author Comment

by:chrislindsay
ID: 40428148
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
0
 
LVL 8

Expert Comment

by:tshearon
ID: 40428516
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:chrislindsay
ID: 40428678
Hi I would like all the distribution groups returning.....
0
 
LVL 31

Accepted Solution

by:
Gareth Gudger earned 500 total points
ID: 40430818
Check out this blog post here.
http://oxfordsbsguy.com/2014/04/21/exchange-powershell-how-to-enumerate-distribution-lists-managers-and-members/

foreach ($group in Get-DistributionGroup) { get-distributiongroupmember $group | ft alias, @{label=’Group′;expression={$group.name}}} | export-csv c:\distro_contacts.csv
0
 

Author Closing Comment

by:chrislindsay
ID: 40436908
Worked well thanks
0
 
LVL 31

Expert Comment

by:Gareth Gudger
ID: 40438092
Great stuff.
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question