Solved

Search for subgroups within a group using ADSI

Posted on 2003-11-18
5
283 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now