header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Get-DistributionGroupMember from Exchange
Last Post 31 Oct 2011 06:19 AM by Karl Mitschke. 5 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
PaulUser is Offline
New Member
New Member
Posts:4
Avatar

--
26 Oct 2011 04:33 AM
    I need to get the members of several distributions groups in Exchange, I use the Get-DistributionGroupMember - identity 'Group Name' but there is no recursive function.
    I need help in getting the members of the groups even the nested groups.
    markrailtonUser is Offline
    New Member
    New Member
    Posts:45
    Avatar

    --
    26 Oct 2011 04:42 AM
    dunno if this will help you but i had to get a list of all user of groups in a specific OU.

    script:

    $myCol = @()
    ForEach ($Group in (Get-QADGroup -SearchRoot “domain.corp/OUname” -SizeLimit 0 -GroupType Security))
    {
    ForEach ($Member in (Get-QADGroupMember $Group))
    {
    $myObj = "" | Select Group, Member
    $myObj.Group = $Group.Name
    $myObj.Member = $Member.Name
    $myCol += $myObj
    }
    }
    $myCol | Export-Csv -Path "C:\SGMembers.csv" -NoTypeInformation

    i'm sure you can do something similar with distribution groups, i will take a look in a test enviroment.

    just change the object type from security to distribution.

    markrailtonUser is Offline
    New Member
    New Member
    Posts:45
    Avatar

    --
    26 Oct 2011 05:18 AM
    $myCol = @()
    ForEach ($Group in (Get-QADGroup -SearchRoot “domain.corp/distribution groups” -SizeLimit 0 -GroupType distribution))
    {
    ForEach ($Member in (Get-QADGroupMember $Group))
    {
    $myObj = "" | Select Group, Member
    $myObj.Group = $Group.Name
    $myObj.Member = $Member.Name
    $myCol += $myObj
    }
    }
    $myCol | Export-Csv -Path "C:\DGMembers.csv" -NoTypeInformation




    This did the trick for me :D, you will need quest active directory cmdlets.
    PaulUser is Offline
    New Member
    New Member
    Posts:4
    Avatar

    --
    28 Oct 2011 09:37 AM
    Thanks, I actually used a similar script utilizing Quests AD PowerShell comandlets, but in this case those wont work, i'm querying the exchange server for distibution groups.
    markrailtonUser is Offline
    New Member
    New Member
    Posts:45
    Avatar

    --
    31 Oct 2011 01:41 AM
    if you trying to get members of nested groups i'm sure the script above will output the information you need. Like i said change the grouptype to distribution and then you good to go.
    Karl MitschkeUser is Offline
    Basic Member
    Basic Member
    Posts:457
    Avatar

    --
    31 Oct 2011 06:19 AM
    http://unlockpowershell.wordpress.com
    Co-Author, Windows PowerShell 2.0 Bible
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer