Solved

Getting domains, users and groups from Active Dir using LDAP

Posted on 2004-09-01
9
472 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

837 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