Question : Count of users in AD group

Hi

I would like to get a count of users in a Distribution group in AD.

I have used the following command to get an export to xls, csv, txt but the columns aren't arranged in a way to allow me to check out how many users there are.

ldifde -f c:\emeatxt.txt -d "cn=\#Group A,ou
=users,ou=UK,ou=Europe,dc=emea,dc=kam,dc=com" -l "member"

Does anyone know how I can get a count?

Cheers

Answer : Count of users in AD group


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
Random Solutions  
 
programming4us programming4us