Friday, October 10, 2014

Quickie: Number of Members in All Groups

I wanted a quick report on all the groups for a certain project and which had no members. This line will provide you a quick member count on all your DLs. Since it uses native Exchange 2010 cmdlets, it won't give you a recursive member count.

Get-DistributionGroup -resultsize unlimited | Select Displayname, @{Name="MemberCount";Expression={$x = Get-DistributionGroupMember -resultsize unlimited -Identity $_.identity;if($x -is [array]){$x.count} elseif ($x -eq $null) {0}else {1}}}

No comments:

Post a Comment