Generally LDAP queries for groups require the fully distinguished name of the user and the Group.
If you know the specific group then a LDAP Query like:
ldapsearch -H ldaps://server.domain.com:636 -x -D "[email protected]" -W -b "CN=myusername,CN=Users,DC=domain,DC=com" -s sub -a always -z 1000 "(&(sAMAccountName=myusername)(Memberof=CN=Domain Admins,OU=Users,DC=subdomain,DC=domain,DC=com))" "objectClass"
That returns a DN implies there the user sAMAccountName=myusername is a member of that specific Group.
If no DNS are returned then there is not sAMAccountName=myusername that is a member of that specific group.
However, this would not include any nested groups.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…