Solved

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

Posted on 2014-09-19
6
331 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
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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

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

Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to overlay text on an inline graphic? 5 55
Emal issues 3 46
Trojan Attachments Email 3 81
InTune and Email accounts 2 102
Earlier today, Google rolled out a new feature, Google Buzz; and the aptly named tool, is already creating quite a stir on the World Wide Web.  According to his post on the Gmail blog, (http://gmailblog.blogspot.com/) Edward Ho, tech lead for Google…
Zimbra is famous for its platform independency, ability to manage multiple user accounts, easy assimilation with 3rd party applications, social network certification etc. Here, we discuss about how users can move multiple Zimbra user accounts to Exc…
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 …
A simple description of email encryption using a secure portal service. This is one of the choices offered by The Email Laundry for email encryption. The other choices are pdf encryption which creates an encrypted pdf of your email and any attachmen…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now