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.
01Command
$ $os = Get-CimInstance Win32_OperatingSystem
$os.LastBootUpTime
(Get-Date) - $os.LastBootUpTime02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Get-CimInstance - SS64Evidence: Get-CimInstance retrieves WMI/CIM class instances and supports date conversion of CIM timestamps.
- Win32_OperatingSystem classEvidence: Win32_OperatingSystem exposes LastBootUpTime and other OS properties queryable via Get-CimInstance.
Last verified: 2026-09-17 · Category: System & Settings
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Create or update a .zip from any files or folder contents straight from PowerShell.
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.