Solved

Search for subgroups within a group using ADSI

Posted on 2003-11-18
5
291 Views
Last Modified: 2007-12-19
Hi,
I am trying to get the groups included in another group using ADSI. In the principal group  I have users and groups on it. I´m trying to get these groups included on the principal filtering the members collection, but i'm not getting the collection filtered. I'm using following code:

Dim adsgroup As ActiveDs.IADsGroup
      Dim adsSubGroup As ActiveDs.IADs
      Dim sFilter() As String

            adsgroup = GetObject(sFormattedGroupName)
            ReDim Preserve sFilter(0)
            sFilter(0) = "Group"
            adsMembers = adsgroup.Members

            adsMembers.Filter = sFilter

            For Each adsMembers In adsMembers

           next

Can anyone tell me why this is not working?

Thank you
0
Comment
Question by:purbano
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Dranizz
ID: 9771447
There could be members of members, so use a function that recall itself if that appends

Also

  sFilter(0) = ("(objectClass=group)")

remember that filter is case sensitive, so the class type and the classname are case sensitive
0
 

Author Comment

by:purbano
ID: 9771721
Thank you Dranizz, but I'm afraid it doesn't work.

Any other idea.

Thanks
0
 
LVL 8

Accepted Solution

by:
Dranizz earned 250 total points
ID: 9771795
Use the DirectoryServices.Dll reference
and use the DirectorySearcher class

look at this

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdirectoryservicesdirectorysearcherclasstopic.asp
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10268131
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: Dranizz {http:#9771795}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question