Getting "wake source" in c# like powercfg -lastwake RRS feed

  • Question

  • Hello,

    I need to get the wake source after a resume. It is possible to get it via "powercfg -lastwake", but want to have this information in my program. It is written in c#.

    I already tried to get this information via WMI, but I didn't find the right classes.

    My program should set an the "balanced-powerplan" after waking up due to RTC. If the computer wakes up due to an usb device or power button, the program will set "high performance"-powerplan.

    Thanks you very much for any advice on this topic! :-)

    Best regards,


    Friday, May 14, 2010 12:10 PM


  • Hi,

    As far as I can see, it's not possible to get these inform via wmi.

    You might try to start the tool using a process object.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Harry Zhu Monday, May 24, 2010 9:55 AM
    Wednesday, May 19, 2010 7:17 AM