Author Posts

July 9, 2017 at 4:59 pm

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)

July 9, 2017 at 5:11 pm

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.

July 9, 2017 at 5:42 pm

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.

July 10, 2017 at 11:08 am

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

July 10, 2017 at 2:35 pm

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