Solved

List all network computers by both name and ip?

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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