Solved

List all network computers by both name and ip?

Posted on 2007-11-13
3
205 Views
Last Modified: 2010-04-15
I have incomplete code, help...

 DirectoryEntry root = new DirectoryEntry("WinNT:");
            foreach (System.DirectoryServices.DirectoryEntry dDom in root.Children)
            {
                foreach (System.DirectoryServices.DirectoryEntry dPC in dDom.Children)
                {
                    listBox1.Items.Add(dDom.Name + "/" + dPC.Name);
                }
            }        
0
Comment
Question by:kvnsdr
  • 2
3 Comments
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20277441
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 20277625
Nice but, List all network computers by both name and ip?

I cannot locate any code on the Internet that lists all network computer by IP address.
0
 
LVL 22

Accepted Solution

by:
RedKelvin earned 250 total points
ID: 20277956
No worries, that code returns all the names, you can resolve the IP address using the machine name using Dns.Resolve

IPHostEntry hostInfo = Dns.Resolve(hostString);

IPAddress[] address = hostInfo.AddressList;

Hoststring is the machine name

http://msdn2.microsoft.com/en-us/library/system.net.dns.resolve(VS.71).aspx
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now