?
Solved

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

Posted on 2014-09-19
6
Medium Priority
?
395 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 1000 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 1000 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Explore the encryption capabilities built into Google Apps and how these features can help you meet privacy policy and regulatory compliance, but are not a full solution. Understand and compare the most popular email encryption services for Google A…
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
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…
Suggested Courses

718 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