IT Toolbox
Menu
PowerShell · Windows

Show the last boot time and Windows uptime

Calculates how long Windows has been running since the last full restart.

Low risk

Command

$OS = Get-CimInstance Win32_OperatingSystem $Uptime = (Get-Date) - $OS.LastBootUpTime [PSCustomObject]@{ DernierDemarrage = $OS.LastBootUpTime Jours = $Uptime.Days Heures = $Uptime.Hours Minutes = $Uptime.Minutes }

When to use it

Use this to confirm whether a workstation really restarted after an update or incident.

How it works

  • Windows exposes the last boot time through Win32_OperatingSystem.
  • The script then calculates the elapsed uptime.

Precautions

  • Windows Fast Startup can sometimes make a shutdown and power-on look different from a full restart.

Rollback

No changes are made.

Support the development of BAOI Hosting, domains and new IT resources.
❤️ Support BAOI