473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

getting user names out of AD

I'm trying to get all the user names of users out of an active directory so
they can be put into a database, but when i run the code below it gives
nothing back, if i change username to just name it gives me the full name of
the user, but not the user name... what is going wrong? thanks

Dim entry As New DirectoryEntry("LDAP://reschini")

Dim mySearcher As New DirectorySearcher(entry)

mySearcher.Filter = "(objectClass=user)"

Dim resEnt As SearchResult

For Each resEnt In mySearcher.FindAll

Try

Me.ListBox1.Items.Add(resEnt.GetDirectoryEntry.Use rname)

Catch ex As Exception

End Try

Next
Nov 20 '05 #1
1 1125
Dim entry As New DirectoryEntry "LDAP://reschini")
Dim mySearcher As New DirectorySearcher(entry)
mySearcher.PropertiesToLoad.Add("cn")
mySearcher.Filter = "(objectclass=user)"
Dim resEnt As SearchResult

For Each resEnt In mySearcher.FindAll
If Not IsNothing(resEnt.Properties("cn")) Then
Me.ListBox1.Items.Add(resEnt.Properties
("cn")(0))
End If
Next

I took out the try in order to catch the errors, but this
should work. I think the Username is used when
Authenicating users. Hope this helps
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
1
by: Thomas | last post by:
Hi - I've managed to get an ole db provider to read information in from an excel spreadsheet, but I have to include the sheet name in the select statements. I was wondering if someone could help...
2
by: Sabin Finateanu | last post by:
Hi! Can anyone tell me how can I get the user group for the current windows user? Please help me! Sabin Finateanu
3
by: Chakkaradeep | last post by:
Hi all, How to retrieve Users Names and also restrict internet access to a specific users using C# ? Thanks. Regards, C.C.Chakkaradeep
1
by: Timothy.Rybak | last post by:
I need help designing a database that keeps up with a point system we have here at work. I'll tell you what I know. First, I have a list of all the employee names for a table. Second, for...
4
by: shashank kadge | last post by:
hi all, i am trying to get local admin users and groups on a windows server. here is the C# code that i am using...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
3
by: =?Utf-8?B?WmlhbmdpIEpvbmVz?= | last post by:
Hi, I m using VS .NET 2003 to create a website. Using the setup package I create a setup as well. But this setup has files with actual code in it & not pre-compiled DLLs. Please let me know...
4
by: JHite | last post by:
I am using Access 2003 on Windows XP. This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.