Solved

Getting domains, users and groups from Active Dir using LDAP

Posted on 2004-09-01
9
467 Views
Last Modified: 2012-06-22
I am trying to get different domains, their groups and users in groups from active directory server using LDAP. First of all I have to populate the listing of all the groups and their domains from active dir in combo box,  now user can select any group from this combo. As soon as user selects this group all the user belonging to this group will be displayed in datagrid with thier attributes like first name, last name, email, address, phone from active dir.
Any help in this regard would be appriciated.
I have tried to used the Active DS Type library in VB6 and successfully implemented the above functionality but i want generic solution using LDAP.  

Is there any way to get default domain using Active DS Type library?

Hamood
0
Comment
Question by:hamood
9 Comments
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11953532
0
 
LVL 4

Author Comment

by:hamood
ID: 11953678
I have checked this but it is not what i needed. I want to get all domains first then after selecting any domain i will get all its groups and when any one selects any groups all its user should be displayed with their attributes in the grid. Actually i need to get displayed all the existing domains, groups and users in active dir but every thing depends on the next one
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11953740
try something like this to get domains

Set objWinNT = GetObject("WinNT:")
For Each objDomain In objWinNT

Next
0
 
LVL 8

Assisted Solution

by:mladenovicz
mladenovicz earned 100 total points
ID: 11953804
Oops, I forgot one lin

Set objWinNT = GetObject("WinNT:")
For Each objDomain In objWinNT
   Response.Write objDomain.Name
Next
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:mladenovicz
ID: 11953860
Set objWinNT = GetObject("WinNT:")
For Each objDomain In objWinNT
   Debug.Print objDomain.Name
Next
0
 
LVL 20

Assisted Solution

by:hes
hes earned 100 total points
ID: 11954940
Check out the excellent example here :

http://www.freevbcode.com/ShowCode.Asp?ID=1896
0
 
LVL 4

Author Comment

by:hamood
ID: 11961098
hes
thanx I have already checked the example at the location and currenty i am using the same technique. But I have to do the things using LDAP because this example uses ADTS library.

mladenovicz
Thanx for the code. I am already using this type of code to get domains but i have to do the things using LDAP. I need a favour in ADTS library for getting default domain of the Active Dir. I would appriciate if you could help me in this regards

Thanx
Hamood
0
 
LVL 12

Accepted Solution

by:
jkaios earned 200 total points
ID: 12006892
Hamood, try this one:

 Dim oRoot, oDomain, sDomain
 
 Set oRoot = GetObject("LDAP://rootDSE")
 sDomain = oRoot.Get("defaultNamingContext")
 Set oDomain = GetObject("LDAP://" & sDomain)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 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

20 Experts available now in Live!

Get 1:1 Help Now