Good morning :)
We can simplify it a bit, or at least make it include less parentheses on a single line:
$DN = (Get-QADGroup "Group 1").DN
$Filter = "(&(objectCategory=person)(memberOf=$DN))"
(Get-QADUser -SizeLimit 20000 -LdapFilter $Filter).Count
Just make sure $Filter returns a reasonable value.
@BSonPosh,
A little ignorant about those, but aren't Legacy groups those where Link Value Replication is not in use? That shouldn't have an impact on returning membership though should it?
Chris