Click to See Complete Forum and Search --> : Machine Names


mohamedriji
January 16th, 2003, 10:44 PM
Hi,

Is it possible to display the names of all the online machines that are connected to a network using VB.Net

bratuha
January 23rd, 2003, 11:12 AM
I have never worked with it but i think you have to use active directory service

deadcoconuts
March 4th, 2005, 05:29 PM
Imports System
Imports System.DirectoryServices

Namespace ActiveDirectorySearch1
Class Class1
Shared Sub Main(ByVal args() As String)
'Note : microsoft is the name of my domain for testing purposes.
Dim enTry As DirectoryEnTry = New DirectoryEnTry("LDAP://microsoft")
Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
mySearcher.Filter = ("(objectClass=computer)")
Console.WriteLine("Listing of computers n the Active Directory")
Console.WriteLine("=========== ===========")
Dim resEnt As SearchResult
For Each resEnt In mySearcher.FindAll()
Console.WriteLine(resEnt.GetDirectoryEnTry().Name.ToString())
Next
Console.WriteLine("=========== End of Listing =============")
End Sub
End Class
End Namespace