PowerTip: Use PowerShell to Find System Uptime

Doctor Scripto

Summary: Use Windows PowerShell to find your system uptime.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily find how long my computer has been running?

Hey, Scripting Guy! Answer Use the Get-Date cmdlet to return the current date and time, and then subtract the value
           of the LastBootUpTime property that comes from the Win32_OperatingSystem, for example:

(get-date) – (gcim Win32_OperatingSystem).LastBootUpTime

Note  GCIM is an alias for Get-CimInstance.

0 comments

Discussion is closed.

Feedback usabilla icon