asked on
Dim searchRoot As New DirectoryEntry("LDAP://DC=DOMAIN,DC=local")
Dim searcher As New DirectorySearcher(searchRoot) With { _
.Filter = "(objectClass=computer)" _
}
searcher.PropertiesToLoad.Add("name")
searcher.PropertiesToLoad.Add("description")
searcher.Filter = "(&(objectClass=computer))"
Dim results = searcher.FindAll
For Each result In results
If result.Properties.Contains(txtUsernameSc.Text) Then
txtHostName.Text.ToString(result.GetDirectoryEntry().Properties("name").Value())
End If
Next
Nothing is returned though.