Hello,
This is my first post in the forum, thanks in advance for your help.
So, I need to count the total number of groups a user is member of (including nested), but using the LDAPFilter and NOT the -Filter, the LDAPFilter is far away the faster and I need to process more than 20 000 users. Moreover, I also want to know how to do that with LDAP.
The Quest cmdlet works but very slow : (Get-QADUser user).AllMemberOf
I don't want to use adfind, dsquery, etc. No, I want that with pure LDAP syntax in the LDAPFilter.
The difference between -LDAPFilter and -Filter is awesome.
Measure-Command -Expression {Get-ADObject -LDAPFilter "(&(|(objectclass=user)(objectclass=computer))(memberOf=CN=Test Group,OU=Groups,DC=domain,DC=local))"} | Format-List TotalSeconds
TotalSeconds : 0,4034246
Measure-Command -Expression {Get-ADObject -Filter 'objectclass -eq "user" -or objectclass -eq "computer" -and memberof -eq "CN=Test Group,OU=Groups,DC=domain,DC=local"'} | Format-List TotalSeconds
TotalSeconds : 25,0171279
Thanks in advance