Saturday, 10 October 2009

Get The Members Of An Exchange 2007 Distribution Group…

Many a times we are faced with the task of getting all the members in a distribution group, especially in a large group. It is very easy with Powershell. Run the following command,

Get-DistributionGroupMember –identity “group name”

In order to select the properties we need, pipe the command to format-table with the necessary values.

Get-DistributionGroupMember –identity “group name” | ft name, primarysmtpaddress

1

As usual, we can export the output to a txt or csv file.

Get-DistributionGroupMember –identity “group name” | ft name, primarysmtpaddress | Export-CSV c:\members.csv


9 comments:

Anonymous said...

Very helpful ,Thanks Liam

Rajith Jose Enchiparambil said...

Thanks Liam.

Anonymous said...

Hey !

I have a distribution list which contains other distribution groups. Is there any way to list all the members who is member of the main group?

example:
Got a group called A, and this group is has members B and C. B and C contains users.
I need to get a list of alle the members who indirectly is member of the main group A.

Thanks.

Rajith Jose Enchiparambil said...

Easiest will be to install PowerGUI, a free GUI to manage AD, Exchange, VMWare etc and run Get-QADGroupMember "group name" -Indirect from the script editor or load the quest snapin in powershell and run it from there.

http://www.powergui.org

Anonymous said...

For the problem Selvian posted, in detail (i.e.) I downloaded ActiveRoles Management Shell for Active Directory 32-bit in my windows xp from http://www.quest.com/powershell/activeroles-server.aspx
and then from Desktop Programs\Quest\Software\ActiveR... lauch the shell. Otherwise you can use it from PowerGUI (getting it from Files\Powershell libraries)

Leo

Rajith Jose Enchiparambil said...

Thanks for the explained post Anonymous.

Unknown said...

can i get output as count of members for each distribution group of my exchange 2007 from one command

Anonymous said...

You cannot pipe from a format-table into an Export-Csv.

You have to use Get-DistributionGroupMember –identity “group name” | Select-Object name, primarysmtpaddress | Export-CSV c:\members.csv

See http://blogs.msdn.com/b/powershell/archive/2007/03/07/why-can-t-i-pipe-format-table-to-export-csv-and-get-something-useful.aspx

Rajith Jose Enchiparambil said...

Thanks

Post a Comment