How to use ldapfilter with ldapsearch to get group names?



I'm running a ldapsearch for groups to get its members, but I need only the group objects excluding the user objects, I'm trying to to use sAMAccountType to differentiate the groups and users of the parent group but its not working, is there any alternative option?

ldap search i'm using:

|ldapsearch domain="abc" search=(&(objectClass=group)(cn=tt_users))|ldapgroup |table cn member_name|mvexpand member_namemember|ldapfilter search "cn=$member_name$ attrs"sAMAccountType"|search sAMAccountType="Group_Object"|table cn member_name sAMAccountType

0 Karma

Path Finder

This code leave only group objects, excluding the user objects.

| ldapsearch search="(&(objectClass=group)(cn=tt_users))" attrs="cn,distinguishedName"
| ldapgroup
| table cn member_name
| mvexpand member_name
| ldapfilter search="(&(objectClass=group)(cn=$member_name$))" attrs="objectSid"


Hi there @kiran331

Im not quite sure what you are trying to accomplish, can u elaborate further ?

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!