Is it possible to retrieve all AD groups recursively given a user's SAM Account identifier?
I've been using the following ldapsearch filter
ldapsearch -D 'domain\john.doe' -W -h 'ldap.domain.com' -b 'DC=domain,DC=local' '(member:1.2.840.113556.1.4.1941:=CN=John Doe,OU=Users,OU=World,DC=domain,DC=local)' dn
to query our local LDAP server (based off AD) to retrieve the user's AD groups but it's a two-step process since I need to the users full DN.
Previously I used to get a user's direct groups by users the non-recursive filter:
ldapsearch -D 'domain\john.doe' -W -h 'ldap.domain.com' -b 'DC=domain,DC=local' '(|(userPrincipalName=john.doe@domain.com)(sAMAccountName=john.doe))' dn
Is it possible to achive the result of the first query (all AD groups recursively) and the single step of the second query (since I only needed to know the email address of user of the username