Is there an universal way (working on Windows XP/Vista/7) to determine the time of 'turn off/turn on' or 'hibernate/wake up' of the computer?

edit: I want to determine it programmatically.

link|improve this question
Do you mean when it happened, or how long the timeout is before it happens automatically? Or something else? The question isn't clear. – Joe White May 19 '11 at 19:55
Check the event viewer. Start -> Run -> eventvwr.exe – Merlyn Morgan-Graham May 19 '11 at 19:55
@Joe White: when it happened – anth May 19 '11 at 20:01
feedback

migrated from stackoverflow.com May 20 '11 at 23:32

This question came from our site for professional and enthusiast programmers.

4 Answers

You may need to access the BIOS if the system in question is using any Wake-On-LAN settings. You would use the Win32_BIOS class for that.

link|improve this answer
feedback

If you are looking for a setting in Windows, check out the WMI classes in .Net (System.Management namespace).

link|improve this answer
feedback

Take a look at the EventLog class.

link|improve this answer
feedback

Initializes a new instance of the ManagementClass class. The class represents a Common Information Model (CIM) management class from WMI Classes.. Check example on the documentation page that may help you about usage of these.

For more information, see "Win32 Classes" in the Windows Management Instrumentation documentation in the MSDN Library here

If you use Windows Development Kit library then there are lots of library methods to get information either using WMI classes and scripting management catalogs.

If you get it through windows development kit then check this.

http://blogs.technet.com/b/heyscriptingguy/archive/2010/08/31/get-windows-power-plan-settings-on-your-computer-by-using-powershell.aspx

link|improve this answer
feedback

Your Answer

 
or
required, but never shown