searching for a user in active directory by username



Im creating a app that will pull a list of usernames in a txt doc and
then find them in active directory and set the "User must change
password at next login" attribut. I would like to limit it to a
specific out and all sub OU under it. Im having issues nailing down the
scope. I set the OU i want to start but it seems to go outside that OU
and also not filtering the objectclass to just users. This is what i
got so far. Also if i could get help checking that attribute to have
them change there password too. Thanks.
Imports System
Imports System.DirectoryServices

Namespace ActiveDirectorySearch
Public Class ADSearch
Shared Sub main(ByVal strUserName As String)
Const strLDAP = "LDAP://ou=MINN Corporate,ou=CORP
Users,dc=corp,dc=eschelon,dc=com"

Dim DSESearcher As DirectorySearcher = New DirectorySearcher(strLDAP)


DSESearcher.Filter = ("(objectClass=user)")

Dim objResults As SearchResult

For Each objResults In DSESearcher.FindAll()
Console.WriteLine(objResults.GetDirectoryEntry.Path.ToString)

Next
End Sub
End Class
End Namespace


any help would be great

.



Relevant Pages

  • Export Usernames from an OU
    ... just one OU in active directory called council staff. ... Call ExcelSetup("Sheet1") ' Sub to make Excel Document ... Set objwb = objExcel.ActiveWorkbook.Worksheets ...
    (microsoft.public.scripting.wsh)
  • Re: Export Usernames from an OU
    ... just one OU in active directory called council staff. ... Call ExcelSetup("Sheet1") ' Sub to make Excel Document ... Set objwb = objExcel.ActiveWorkbook.Worksheets ...
    (microsoft.public.scripting.wsh)
  • Re: View number of objects in entire OU?
    ... To count number of objects in an OU (and sub OU's): ... ' Search entire Active Directory domain. ... ' Filter on all objects. ... ' Construct the LDAP syntax query. ...
    (microsoft.public.windows.server.active_directory)
  • Active Directory Export
    ... I'm trying to set up an organisational phonebook in Excel, ... Private Sub CommandButton1_Click ... placed in the IPPhone field in Active Directory. ... When I run the script, I'm getting a Type Mismatch error. ...
    (microsoft.public.excel.programming)