By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Enumerating users in AD

P: n/a
Hi all,

I'm looking for some example code that shows how to enumerate users with
vb.net. I'm trying to write an application that can read/write specific
properties of user objects in the directory.

I'm new to vb.net, so I need a nudge in the right direction to get me
rolling.

Thank you.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

http://msdn.microsoft.com/library/de...ch_results.asp

Ken
----------------
"NetworkElf" <su**@somedomain.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm looking for some example code that shows how to enumerate users with
vb.net. I'm trying to write an application that can read/write specific
properties of user objects in the directory.

I'm new to vb.net, so I need a nudge in the right direction to get me
rolling.

Thank you.

Nov 21 '05 #2

P: n/a

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Hi,

http://msdn.microsoft.com/library/de...ch_results.asp

That appears to be exactly what I need. Thank you.

BTW, has anyone else been having odd problems with google and group
searches? I'm certain that someone had helped me with this before (or
something very similar), but I could not find reference to the thread when I
was hunting for it.

ne.
Nov 21 '05 #3

P: n/a

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Hi,

http://msdn.microsoft.com/library/de...ch_results.asp

OK, the above link led me to some excellent reading. Some of it I even
understand... :p

This is the code I'm working with at the moment:
Dim last, first, email, userpath As String
Dim sizeLimit, pageSize As Integer
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=whacko,DC=net")
Dim mySearcher As New
System.DirectoryServices.DirectorySearcher(entry)
Dim result As SearchResult
mySearcher.Filter = ("(objectClass=user)")

For Each result In mySearcher.FindAll()
userpath = result.GetDirectoryEntry().Path

lstLastName.Items.Add(userpath)
Next

First problem: I seem to have incorrectly specified the search filter, as
the search returns both user and computer objects.

Second problem: I'm uncertain how to take the LDAP path that gets stuffed
into userpath and get individual object properties (first and last name).

Another nudge would be appreciated.

Also any reading suggestions on vb.net and Active Directory (other than
MSDN) would be most appreciated.

Thanks -

ne.
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.