How can I find out when Windows was last started?

systeminfo shows when the system came up after a restart, but does not show when it comes up after a shutdown and then a power on.

For instance when I run this command:

systeminfo | find "Sys"

the output shows:

System Boot Time:          8/10/2018, 8:45:22 AM

Which was when I did a restart.

I tried a solution in the previous question:

Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Where { $_.Id -eq 200 }

and got these results on my laptop:

PS C:\Program Files\PowerShell\6.0.0> Get-WinEvent -LogName Microsoft-Windows-Diagnostics-Performance/Operational | Wher
e { $_.Id -eq 200 }


   ProviderName: Microsoft-Windows-Diagnostics-Performance

TimeCreated                     Id LevelDisplayName Message
-----------                     -- ---------------- -------
7/30/2018 1:54:18 PM           200 Critical         Windows has shutdown: ...
6/29/2018 9:08:40 AM           200 Critical         Windows has shutdown: ...


PS C:\Program Files\PowerShell\6.0.0>

I'm looking for the time I turn on the computer and the time I shut it down each day. I'd like a command line so I can collect the information into a batch file.


Open a PowerShell command prompt and enter:

Get-WinEvent -ProviderName Microsoft-Windows-Kernel-boot -MaxEvents 10 | Where-Object {$_.id -eq "27"}

Which will return:

ProviderName: Microsoft-Windows-Kernel-Boot

TimeCreated                      Id LevelDisplayName Message
-----------                      -- ---------------- -------
3/6/2021 1:00:00 PM              27 Information      The boot type was 0x1.

In the Message field you'll see one of these boot types:

Boot             Type Description
0x0              cold boot from full shutdown
0x1              hybrid boot (fast startup)
0x2              resume from hibernation

If you restarted the boot type will be 0x0.

If you shut down and then started the boot type will be 0x1 (assuming you have Fast Startup enabled which is the default)