Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

Query the Contents of an Container and/or Security Group in Active Directory

With Visual Basic I would like to query the contens of an container and/or the users assigned to a global security group from active directory.
0
FPhillips
Asked:
FPhillips
1 Solution
 
GunsenCommented:
Add "Active DS Type Library" below Project-References.

To enumerate container:
  Dim c As IADsContainer
  Set c = GetObject("LDAP://ou=Groups,dc=company,dc=net")
  For Each obj In c
    Debug.Print obj.Name
  Next

To list group members:
  Dim group As IADsGroup
  Set group = GetObject("LDAP://cn=group1,ou=Groups,dc=company,dc=net")
  For Each User In group.Members
    Debug.Print User.Name
  Next
0
 
CleanupPingCommented:
FPhillips:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept Gunsen's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0
 
ShelfieldCollegeCommented:
Hi there, I just wanted to add an additional thank you to Gunsen for this code.  It's proving invaluable in the development of the software applications I'm writing at present.  Using it to get lists of groups in AD, of Users in a specific group and then using these lists to validate users who log into our systems. Outstanding, thank you! :)

Cheers

-Matt-
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now