0 Replies Latest reply: Sep 17, 2012 3:05 AM by prigupta RSS

    How to get member of group from LDAP

      Hi,

       

      I am trying to find out all the member belonging to specific group but no success.

      I tried this query

       

      after connecting to LDAP

       


      UserTable:
      Load
           Trim(Upper(''&sAMAccountName)) as NTNAME,
           DistinguishedName as KEY_User,
           Name as USER,
           department as [Division Function],
           displayName as DisplayName,
           mid(subfield(DistinguishedName,',',2),4) as [User Country],
          
         

           company as [Legal Company],
           mail as [E-Mail];
      SQL select
      objectSID,
      ADSPath,
      DistinguishedName,
      Name,
      displayName,
      //title,
      department,
      company,
      mail,
      sAMAccountName
      //telephoneNumber
      FROM 'LDAP:/dc=vs,dc=local'    
      WHERE objectCategory='Person' AND objectClass='user'  ;

      groupTable:
      Load
          distinguishedName as GroupKey,
           cn as "Group Name",
           subfield(member,'|') as KEY_User;


      SQL select
      distinguishedName,cn,member

      from
      'LDAP:/dc=vs,dc=local'
      where objectCategory = 'GROUP' and objectClass='group'
      and sAMAccountName='groupname1' or sAMAccountName='groupname2' or sAMAccountName='groupname3' or sAMAccountName='groupname4' or sAMAccountName='groupname5'
      or sAMAccountName='groupname6' ;

       

       

      This query gives me all the users & all the groups but nt user belonging to specific group.

       

      Result as below

       

      Username     groupname

      user1                 -

      user2                 -

      user3                 -

      user4                 -

      user5                 -

      user6                 -

      -                     group1

      -                     group2

      -                     group3

      -                     group4

      -                     group5