Getting Boot time, logon time and start up time programmatically RRS feed

  • Question

  • Hi,

    we have a requirement to get the following data through code (c# or c++)

    Boot Time - After powering on the device, the boot duration is the time between the start of the OS kernel and the launch of the logon screen.

    Logon Time - The time between user enter credentials and the desktop being shown.

    Start up Time –  The time between user authentication, all startup apps loading and the device being “ready”

    Can i use WMI to get this or are there other options?


    Thursday, July 9, 2020 3:43 PM

All replies

  • Hi,

    for the first two, your best bet is probably event logs. There are some coll scripts out there for measuring the logon duration, they contain most of the relevant Event IDs.

    The last one is tough because even if you somehow catch the start event for a startup app, there is no knowing when it finishes loading from the user perspective.

    Evgenij Smirnov

    Thursday, July 9, 2020 8:50 PM
  • Thanks Evgenij.

    For the first 2,  do i need to look into C:\Windows\System32\wdi\LogFiles\BootCKCL.etl. By any chance, can is it exposed through WMI?

    How about  the reguistry key? HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power


    Thursday, July 9, 2020 10:14 PM
  • Hi,

    Thanks for posting here.

    For Boot Time: You could use WMI class Win32_OperatingSystem, and get the LastBootUpTime property. in this case make sure the "fast startup" option is turn off. Or read  the event log like this sample.

    For Logon Time: I'm not sure if you want to get the last logon time of current user, you could refer to this answer on Stacknbsp; Get current user's last logon

    For the last one, as comments, it is hard to get the actual time when all of the processes are ready. But if you want to get a specified process' create time, you could check this api: GetProcessTimes 

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, July 10, 2020 7:29 AM