I was looking for a uptime
like command for Windows.
The
uptime
command on Linux:$ uptime
12:53:36 up 5:03, 1 user, load average: 0.83, 0.61, 0.36
$ uptime --pretty
up 5 hours, 3 minutes
$ uptime --since
2021-02-17 07:50:35
On Windows, there is the cmdlet Get-Uptime
which is available for PowerShell version 6+.
$ Get-Uptime -Since
Monday, January 18, 2021 7:56:57 AM
If Get-Uptime
is not available, you can query the WMI with a CIM cmdlet.
$ Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object LastBootUpTime
LastBootUpTime
--------------
18.01.2021 07:56:41
The LastBootUpTime
value may not be updated if you have fast boot/startup enabled for your system.