Enumerating users in AD

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NetworkElf

    #1

    Enumerating users in AD

    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.


  • Ken Tucker [MVP]

    #2
    Re: Enumerating users in AD

    Hi,

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

    Ken
    ----------------
    "NetworkElf " <sum1@somedomai n.com> wrote in message
    news:OysfwMebFH A.2696@TK2MSFTN GP09.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.



    Comment

    • NetworkElf

      #3
      Re: Enumerating users in AD


      "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
      news:eZSjlEgbFH A.2688@TK2MSFTN GP14.phx.gbl...[color=blue]
      > Hi,
      >
      >[/color]
      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.


      Comment

      • NetworkElf

        #4
        Re: Enumerating users in AD


        "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
        news:eZSjlEgbFH A.2688@TK2MSFTN GP14.phx.gbl...[color=blue]
        > Hi,
        >
        >[/color]
        http://msdn.microsoft.com/library/de...ch_results.asp[color=blue]
        >[/color]
        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
        DirectoryServic es.DirectoryEnt ry("LDAP://DC=whacko,DC=ne t")
        Dim mySearcher As New
        System.Director yServices.Direc torySearcher(en try)
        Dim result As SearchResult
        mySearcher.Filt er = ("(objectClass= user)")

        For Each result In mySearcher.Find All()
        userpath = result.GetDirec toryEntry().Pat h

        lstLastName.Ite ms.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.


        Comment

        Working...