Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 109
  • Last Modified:

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
0
chrislindsay
Asked:
chrislindsay
1 Solution
 
Adam FarageEnterprise ArchCommented:
Get-DistributionGroupMember -Identity <dl_name@company.com> | Select Identity, PrimarySmtpAddress | Export-CSV C:\DistributionGroup.csv
0
 
chrislindsayAuthor Commented:
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
 
tshearonCommented:
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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
chrislindsayAuthor Commented:
Hi I would like all the distribution groups returning.....
0
 
Gareth GudgerCommented:
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
 
chrislindsayAuthor Commented:
Worked well thanks
0
 
Gareth GudgerCommented:
Great stuff.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now