471,350 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Uptime of system on network

does anyone know of an easy way to say how long has a specific system been
up and running? I just need to get back the uptime of the servers on our
network for a report, they are all in a Active Directory domain... needs to
be in C# or VB.NET preferably. thanks!
Dec 12 '05 #1
4 1758
Brian,

You could just have a service running on the server which will take note
when it starts. Then, to get the uptime, you can call to the service, and
take the difference between the current time and the time that the system
went up.

You could use remoting to access this information as well.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian Henry" <no****@nospam.com> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
does anyone know of an easy way to say how long has a specific system been
up and running? I just need to get back the uptime of the servers on our
network for a report, they are all in a Active Directory domain... needs
to be in C# or VB.NET preferably. thanks!

Dec 12 '05 #2
Brian Henry wrote:
does anyone know of an easy way to say how long has a specific system been
up and running? I just need to get back the uptime of the servers on our
network for a report

[...snip...]

You might check the System EventLog for the youngest event like #6009 (forr
boot up). This can be done with a pure .net solution.

Dec 13 '05 #3
Another possibility is Environment.TickCount. This returns the Number of
milliseconds since the last system bootup. When the System runs for more
than 24.9 Days (or 49.7 days, when you are pInvoking GetTickCount), the tick
count will wrap around, though.
Dec 13 '05 #4

"Brian Henry" <no****@nospam.com> wrote in message
news:OW*************@tk2msftngp13.phx.gbl...
does anyone know of an easy way to say how long has a specific system been
up and running? I just need to get back the uptime of the servers on our
network for a report, they are all in a Active Directory domain... needs
to be in C# or VB.NET preferably. thanks!


You could use System.Management classes to query the servers WMI class
"Win32_Operatingsystem" "Lastboottime" property.

Willy.

Dec 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Oli Schwarz | last post: by
24 posts views Thread by Esmail Bonakdarian | last post: by
4 posts views Thread by Brian Henry | last post: by
4 posts views Thread by Dylan Parry | last post: by
reply views Thread by streamkid | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.