Getting Names of Computers in WorkGroup

This code sample is used to get all the names of computers that are there in your network. The output is displayed in console. It uses the DirectoryEntry and DirectoryServices objects to accomplish this.


Sub Main()
Dim root As New DirectoryEntry("WinNT:")
Dim parent As DirectoryServices.DirectoryEntries
parent = root.Children
Dim d As DirectoryEntries = parent
For Each complist As DirectoryEntry In parent
For Each c As DirectoryEntry In complist.Children
If (c.Name <> "Schema") Then
Console.WriteLine(c.Name)
End If
Next
Next
End Sub


The Sample Provided with application that will allow you to understand more


Hefin Dosuza


Attachments

  • Download Source Code (20027-3540-ListNetworkComputers.rar)
  • Comments

    No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: