I've found that the easiest way to query the AD Directory is by using the Active Directory Provider for ADO. Here's the code for a console app that will give you the distinguished names for all the computers in the built-in Computers container. Just give the app your FQDN and it should give you results. Also keep in mind that I did not include ANY error checking or handling in this.
Hope it helps!
Andy
Imports ADODB
Imports System
Module ListADComputers
Sub Main()
' define local variables
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset
Dim oComm As New ADODB.Command
Dim strComputerName As String
Dim strDomainName As String
' get console parameters
System.Console.WriteLine("What is the name of the AD Domain you wish to query?")
strDomainName = System.Console.ReadLine()
' set connection properties
With oConn
.Provider = "ADsDSOObject"
.Open("Active Directory Provider")
End With
' set command properties
With oComm
.ActiveConnection = oConn
.CommandText = ";(objectClass=computer);distinguishedName"
End With
' open recordset
oRS = oComm.Execute
If Not oRS.EOF Then
oRS.MoveFirst()
Do Until oRS.EOF
System.Console.WriteLine(oRS.Fields("distinguishedName").Value)
oRS.MoveNext()
Loop
End If
' clean up objects
oRS.Close()
oConn.Close()
oRS = Nothing
oComm = Nothing
oConn = Nothing
End Sub
End Module