Solved

List all network computers by both name and ip?

Posted on 2007-11-13
3
208 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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