Hi all how could i check the status of the LAN systems whether they are (connected, sleep mode, active,log in ,log off) using c# for a web application...
-
Could you define what's a "LAN Systems"? Possible duplicate of http://stackoverflow.com/questions/2521569/how-to-detect-working-internet-connection-in-c – Simon Mourier Mar 30 '11 at 06:09
-
The systems that are connected on the same network.. – araf Mar 30 '11 at 06:30
-
Do you want to know the status of other computers connected to the LAN, or the status of the network infrastructure itself? In the 1st case, do you have a list of specific computes, or do you want to discover all connected computers automatically? Do you know the operating system of those computers? are you in the same domain as these computers? – Ophir Yoktan Mar 30 '11 at 07:37
-
@ophir i want to know the status of other computers connected to the LAN,i have already done with discovering all the connected computers automatically .. – araf Mar 31 '11 at 05:27
3 Answers
Pick a PC in your "lan systems" as central unit that will store all connected PCs' status. Each connected PC need to report itself during/before/after "connected, sleep mode, active,log in ,log off".
So, just check that central unit for the latest status of your "lan systems".

- 1,267
- 3
- 17
- 43
If these LAN systems are in the same domain, you could use WMI (provided you have enough rights). There is an example here: Using WMI to retrieve Information - Build Simple Network Browser
The code is VB.Net, but WMI is common to all .NET languages and the logic is quite easy to reproduce.

- 132,049
- 21
- 248
- 298
To check if the machine is up you can use
ping <machine>
here is how to do this from .net
to get information regarding log on status you can use
nbtstat -a <machine>
here is how to do this from .net
I did work only with rhe command line utilities - I didn't tried the attached code samples.
If the machine is powered off, theres no way to query the machine whether it's hibernated or powered off regularly.

- 8,149
- 7
- 58
- 106