.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Network >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Retrive the List Of Computers In Network

Posted By:Hefin Dsouza       Posted Date: September 22, 2009    Points: 10    Category: Network    URL: http://www.dotnetspark.com  
 

This code sample is used to get all the names of computers that are there in your network.
You need to Iterate with the Children entries of the Directory Entries.

The Below Sample is in Console Application


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 Same code can be used to Add the Names of the Network Computers in a Combobox or a ListBox

For Each c As DirectoryEntry In complist.Children
If (c.Name <> "Schema") Then
ComboBox1.Items.Add(c.Name)
End If
Next
Next

Regards
Hefin Dsouza


     

Further Readings:

Responses
Author: WaqasMemon         Company URL: http://www.dotnetspark.com
Posted Date: August 19, 2012

Hi download code from this link for C#...http://codingresolved.com/discussion/71/how-to-get-list-of-network-computers-in-c#Item_2

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend