Check Uptime and Last Boot Time with Get-CimInstance

Get Windows uptime and last boot timestamp using PowerShell's Get-CimInstance with Win32_OperatingSystem, the modern replacement for the deprecated wmic.

WindowswmipowershelluptimeLow risk
Run Get-CimInstance Win32_OperatingSystem in PowerShell and subtract LastBootUpTime from the current date to get uptime.

01Command

Command
$ $os = Get-CimInstance Win32_OperatingSystem
$os.LastBootUpTime
(Get-Date) - $os.LastBootUpTime

02What it does

wmic os get lastbootuptime still runs on Windows 10 but is deprecated and missing from Windows 11 24H2+. Get-CimInstance returns LastBootUpTime as a proper DateTime object, so plain date arithmetic `(Get-Date) - $os.LastBootUpTime` yields a TimeSpan you can format or compare. The same class also exposes TotalVisibleMemorySize and NumberOfProcesses if you want a one-shot system snapshot.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-CimInstance - SS64
    SS64 · technical · 2026-09-17
    Evidence: Get-CimInstance retrieves WMI/CIM class instances and supports date conversion of CIM timestamps.
  • Win32_OperatingSystem class
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Win32_OperatingSystem exposes LastBootUpTime and other OS properties queryable via Get-CimInstance.

Last verified: 2026-09-17 · Category: System & Settings

06Related solutions