0

I want to detect number of online (which has ping successful) machines in network.

with two conditions
1) Don't know its workgroup/Domain (there may be possibility two machines have different workgroups)
2) Don't know its IP address or MAC address.

In short, it should returns all machines (ip addresses) in same networks (say same LAN).

Sam
  • 433
  • 1
  • 10
  • 26

2 Answers2

0

Try using nmap you can give it a rang and even port

user2767168
  • 43
  • 1
  • 5
-1

Edit: plan of attack would be running the ping command on an IP range and mark the IP's that responded. Hope that's not stating the obvious. There's a Ping Class in .Net, as seen here: https://github.com/Simran/nmap-csharp/blob/master/nmap-csharp/Main.cs It's a lot of code so didn't post it.

The other comment suggesting nmap is on the money. It uses many different techniques to determine if a host is online or not. A ping can fail on otherwise "online" hosts depending on firewall settings. If the criteria for "online" is "responds to ping", please check this out: find all ip address in a network

Community
  • 1
  • 1
dunc
  • 81
  • 2
  • 7
  • New to SO, could someone tell me why this was downvoted? Didn't appear the OP had visited google before posting, also appears to be a duplicate of this question: http://stackoverflow.com/questions/4810180/detect-if-machine-is-online-or-offline-using-wmi-and-c-sharp?rq=1 – dunc Oct 05 '14 at 09:49
  • dunc, I don't know type of computer whether it is sqlserver or not. and also I dont know ip address. This is not duplicate question, please read my question carefully. it is just a machine which is online in network, I don't know anything about it. For reading registry or WMI first u must know whether these machines are online or not. – Sam Oct 05 '14 at 11:10
  • The other comment suggesting nmap is on the money. It uses many different techniques to determine if a host is online or not. A ping can fail on otherwise "online" hosts depending on firewall settings. If the criteria for "online" is "responds to ping", please check this out: http://stackoverflow.com/questions/13492134/find-all-ip-address-in-a-network If it needs to be in c#, there's also a c# attempt to duplicate some nmap functionality here: https://github.com/Simran/nmap-csharp/blob/master/nmap-csharp/Main.cs – dunc Oct 05 '14 at 22:54
  • From above links, I don't know whether this machine is belongs to local group or not. and I don't have base ip too. – Sam Oct 06 '14 at 08:17
  • 1. Scan IP range for online machines and get online IP's 2. connect to each via WMI (assuming you have administrator access) 3. Get whatever's needed via WMI. Pretty unclear what you're actually after here, fyi. – dunc Oct 08 '14 at 01:28