Exchange 2013- Need count of DL members alongwith members of nested DL's

Welcome Forums General PowerShell Q&A Exchange 2013- Need count of DL members alongwith members of nested DL's

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 year, 4 months ago.

  • Author
    Posts
  • #74533

    Participant
    Points: 0
    Rank: Member

    Hi,

    I am working on the below script to get DL member count:
    $DistributionGroups = Get-DistributionGroup -Resultsize Unlimited
    $DistributionGroups |? {!((Get-DistributionGroupMember -resultsize unlimited $_).count -gt 100)} | Select Name,PrimarySmtpaddress,@{n="Count";e={(Get-DistributionGroupMember -resultsize unlimited $_).count}} | export-csv final.csv

    The above script will give me DL Name and Count if it has more than 100 members in it.

    However the problem is if DL has 50 members and a nested DL( with more than 100 members in it); then I wont be able to get the output.

    I need to have an output that would give me DL Name and count of members (which includes the members of nested DL)

  • #74536

    Participant
    Points: 144
    Helping Hand
    Rank: Participant

    Could you please format your code as code here in the forum?

    This Technet Forum thread might be helpful for you:

    Get-DistributionGroupMember Recursive Functionality.

    • #74540

      Participant
      Points: 0
      Rank: Member

      Thanks Olaf for taking some time out and checking on it.
      I have tried get-adgroupmember in past but if the group has more than 1000 members then it won't give an output. I have used dsget.exe commands to pull out group members details and query members.
      In my case, I have DL's with nested DL's containing more than 1000 members.

    • #74558

      Participant
      Points: 144
      Helping Hand
      Rank: Participant

      You could try using Get-ADObject. If I remember right there not such a limit.

  • #74579

    Participant
    Points: 1
    Rank: Member

    Shashank, I wrote a function for my company a few months that returns the recursive members of a distribution group plus the name of the nest group they were in. Maybe it might help : Get-DistributionGroupMemberRecursive

The topic ‘Exchange 2013- Need count of DL members alongwith members of nested DL's’ is closed to new replies.