How to list groups and members of the groups
Is there a way to list out groups by the group name and list out the members in those groups? I have been tasked with providing the group names and the members in the group on an Exchange 2010 server.
September 7th, 2011 6:06pm

What kind format do you want the output to be in?[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
September 7th, 2011 6:17pm

either txt or csv.
September 7th, 2011 6:23pm

This musn't be an easy task. Are there any others with some ideas?
Free Windows Admin Tool Kit Click here and download it now
September 7th, 2011 9:31pm

Copy and paste exactly like below into Exchange powershell and press enter. write-output “” > C:\outputDGmembers.txt get-distributiongroup | Sort -Property DisplayName | foreach { $name = $_.displayname $output = ‘Group Name: ‘ + $Name write-output $output >> C:\outputDGmembers.txt Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department >> C:\outputDGmembers.txt write-output “” “” >> C:\outputDGmembers.txt } http://www.wilneumann.org/2009/04/displayexport-the-members-of-exchange-distribution-groups/James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
September 7th, 2011 9:52pm

Are you sure you're launching from Exchange powershell and not Windows powershell? The script works fine for me.James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
September 7th, 2011 10:03pm

This is what i get. The term 'get-distributiongroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:2 char:23 + get-distributiongroup <<<< | Sort -Property DisplayName | foreach { + CategoryInfo : ObjectNotFound: (get-distributiongroup:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
September 7th, 2011 10:03pm

i guess i'm just not doing it right. When i run that in the Exchange Management Shell all that happens is the file is created but with nothing in the file.
Free Windows Admin Tool Kit Click here and download it now
September 7th, 2011 10:09pm

Here is my text capture exactly from my powershell after I copy and paste. You can see it starts to output the results in the console but also sends to the txt file. My guess is when you're copying and pasting there is a break somewhere. [PS] C:\temp>write-output "" > C:\outputDGmembers.txt [PS] C:\temp>get-distributiongroup | Sort -Property DisplayName | foreach { >> $name = $_.displayname >> $output = `Group Name: ` + $Name >> write-output $output >> C:\outputDGmembers.txt >> Get-DistributionGroupMember $name | Sort -Property DisplayName | Select Displ ayName, Alias, Department >> C:\outputDGmembers.txt >> write-output "" "" >> C:\outputDGmembers.txt >> } >> WARNING: Object ipcfcdom.inphonic.com/Distribution Groups/ATTClientServices has been corrupted and it is in an inconsistent state. The following validation errors have occurred: WARNING: There is no primary SMTP address. WARNING: Object ipcfcdom.inphonic.com/Distribution Groups/akamai@inphonic.com has been corrupted and it is in an inconsistent state. The following validation errors have occurred: WARNING: "akamai@inphonic.com" is not valid for Alias. Valid values are: Strings formed with characters from a to z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or more periods may be embedded in an alias, but each one of them should beJames Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
September 7th, 2011 10:18pm

Ok. it took some fiddleing with it but i think i got it to work.
Free Windows Admin Tool Kit Click here and download it now
September 7th, 2011 10:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics