Solved

We need a print out of members of all distribution groups by group.

Posted on 2014-09-19
6
356 Views
Last Modified: 2014-09-23
We have an Microsoft Exchange 2013 server.   We need a print out of members of all distribution groups by group.  Is there a powershell command that will export such a listing to a .csv file.
0
Comment
Question by:Dgreenbaum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:Sean Fitzpatrick
ID: 40333293
You can use Get-ADUser and Export-Csv cmdlets like below:

Get-ADUser -Filter * -SearchBase "ou=Ou,dc=contoso,dc=com" -Properties * | Export-Csv  "c:\somefile.csv"

The parameter "-Filter" is used to specify the query string, "-SearchBase" to specify an Active Directory path to search under and the "-Properties" to specify user's properties you want to export.

Details please go to:
http://technet.microsoft.com/en-us/library/ee617241.aspx

In your case you would be searching by the group that you are looking for, then just change the filter to separate each group into a .csv; or you could broaden your search filter to grab all groups.
0
 
LVL 40

Accepted Solution

by:
Subsun earned 250 total points
ID: 40333304
Get-ADUser will only give the user information, to get the distribution groups and it's members, run the following script from Exchange Management Shell.
$Groups = Get-DistributionGroup -ResultSize Unlimited
$(ForEach ($group in $Groups){
$Group | Get-DistributionGroupMember -ResultSize Unlimited |
  Select @{N="GroupName";E={$Group.DisplayName}},`
		@{N="User";E={$_.DisplayName}},PrimarySmtpAddress
}) | Export-CSV C:\Group.csv -nti

Open in new window

0
 
LVL 16

Assisted Solution

by:Joshua Grantom
Joshua Grantom earned 250 total points
ID: 40333315
Boom, Subsun beat me to it.

Except, I would change Export-CSV C:\Group.csv -nti

to

Export-CSV "C:\$Group.csv" -nti

So you have the name of the Distribution Group in the CSV Filename.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:Dgreenbaum
ID: 40333327
Thanks Subsun!   We will test this and report back.
0
 
LVL 3

Expert Comment

by:Sean Fitzpatrick
ID: 40339601
Ah, thanks for the correction subsun!
0
 

Author Closing Comment

by:Dgreenbaum
ID: 40339629
The script worked well.  Thank you all.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Need helpful information on avoiding losing your Bitcoins to scammers, hackers, or data loss? This article discusses risks of working with Bitcoins and is a follow up to my previous article (http://www.experts-exchange.com/Software/Internet_Email…
How can MDaemon MRK files and MSG files work together? We can also say that, how worldclient and Outlook connecter works, using both application collectively you can view your mails, contacts, calendar, task, notes. In this article you can unders…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…

710 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