Solved

Getting domains, users and groups from Active Dir using LDAP

Posted on 2004-09-01
9
476 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

718 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