Exchange 2010 find empty distribution groups

When we often create distribution groups, we forget about them.

Then we can have empty distribution groups in our Exchange Organization.

To find empty groups we can use Powershell.

First solution we can use EMS with below commands:

$DGs = Get-DistributionGroup -resultsize unlimited
$DGs | where-object {!(Get-DistributionGroupMember $_)}

As a result we receive list of empty distributions groups.

Second solution is to use PowerShell and Quest ActiveDirectory snapin like below:

Get-QADGroup -SizeLimit 0 -Empty $true -GroupType Distribution

Then we can get also empty distribution groups, but we can also modify this command to find security groups.