I know how to get Windows system uptime since last reboot in VBScript or C#, but how do you get system uptime in the last 24 hours? The machine could go down multiple times during this period.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the Event Logs. In the System logs, you should see event #6006 (source: EventLog) when the system goes down, and event #6009 (same source) when it comes back up. See KB article 196452 for more info (note that unexpected shutdowns–that is, crashes–will give event #6008 instead of #6006).
So if you run through all the events of the last 24 hours, your uptime is 24 hours minus all the time between the 6006 and the 6009 events.