What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 1284 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > VB.NET > Retrive the List Of Computers in Network ...
Initiotech

Retrive the List Of Computers in Network

 Code Snippet posted by: Initiotech | Posted on: 9/22/2009 | Category: VB.NET Codes | Views: 1745 | Status: [Member] | Alert Moderator   


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

You can use the same code 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


Regards
Hefin Dsouza
Found interesting? Add this to:


 Responses

Naimishforu
Posted by: Naimishforu | Posted on: 7/25/2011 | Level: Bronze | Status: [Member] [MVP] | Points: 10 | Alert Moderator 

Just a little note that, you will have to Import System.DirectoryServices :)



Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 7:04:01 PM