Security

How to use ldapfilter with ldapsearch to get group names?

kiran331
Builder

Hi

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

BigCosta
Path Finder

Hi!
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"

alemarzu
Motivator

Hi there @kiran331

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

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...