C# – list all computers on a network with cmd or C#


I need to get a list of all the computers on the network

The network is split into two local networks. An admin network and an education network, and then under each of the admin and education networks there are sub nets for each campus. So there is an Admin and an Education Domain controller for each campus.

I can run "net view" in command prompt on each sub net to get a list of all the computers but I would like to be able to just run this on one server, or if I need to two servers (one for the admin network and one for the education network)

I know there are applications like nmap that can do this but I want to be able to use built in windows feature like "net view" or write something my self.

Additional Details:
I have a program (written by a previous developer) that runs as a background service and on each computer that launches a popup and plays an .mp3 file when a fire alarm is set off. I want to get ride of this program and use PsExec to launch the popup and play the message instead of having the service installed on every computer. I have PsExec working but need to get a list of all the computers.

Best Solution

Find All Active/Used IP Addresses on Your Network There is a really neat way that you can quite easily find all active/used IP Addresses on your network without the need for any third party applications or worse, pinging each IP Address manually.

Open the Command Prompt and type in the following:

FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt

Change 192.168.10 to match you own network.

Related Question