A few years back I wrote, “Find Last Reboot Time in Windows 7, Vista and Windows 2008,” where you could find this info via command prompt. This is an update to that for later versions of Windows using PowerShell.
This first way will display how long the network service has been running. Generally this will be very close to the same amount of time (within a few to several seconds usually) as Windows has been running. It won’t be accurate if you restart the network service.
Note: I listed this first because it’s the one I usually use.
1- From a PowerShell window run the following (the ‘S’ in ‘Statistics’ must be capitalized):
net statistics workstation | select-string "Statistics"
You can shortcut it as well using:
net stats work | select-string "Stat"
2- This next method uses the command ‘systeminfo.’ Again from PowerShell run (make sure to capitalize ‘S’, ‘B’ and ‘T)’:
systeminfo | select-string "System Boot Time"
Result (notice how it’s a few seconds earlier than the first command, this is because it’s the actual time the sytem began, where the previous command was when the network stats began):
3- The third method uses WMI, more specifically wmic (Windows Management Instrumentation Command-line), but the output is a little cryptic:
wmic OS Get LastBootUpTime
Result: 20210114142310.677867-360, which can be intrepreted as year 2021, month 01, day 14, hour 14 (or 2:00 PM), minute 23, etc. Note be careful as this may be displayed as UTC depending on your system.
4- Finally, you can use this handy PowerShell script which will display a history of start times:
Get-WmiObject Win32_NTLogEvent -filter "LogFile='System' and EventCode=6005" | Format-Table ComputerName, EventCode, Message, TimeWritten
Just like with anything there are many ways to skin this cat, so choose your favorite one (or two to double-check data) and go for it.