Dim dirEntry1 As DirectoryEntry = New DirectoryEntry("LDAP://DC01/CN=Computers/DC=TEST/DC=COM") Dim dirSearcher As DirectorySearcher = New DirectorySearcher(dirEntry1) dirSearcher.Filter = ("(objectCategory=Computer)") Dim dirSearchResults As SearchResult ' 3. Loop through all the computer names returned For Each dirSearchResults In dirSearcher.FindAll() ListView1.Items.Add(dirSearchResults.GetDirectoryEntry().Name.ToString) Next End Sub
Public Shared Function GetDirectoryEntry() As DirectoryEntry Dim dirEntry As DirectoryEntry = New DirectoryEntry dirEntry.Path = "LDAP://Test/CN=Computers/DC=COM" dirEntry.Username = "TEST\user" dirEntry.Password = "password" Return dirEntry End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)