MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
October
Sun Mon Tue Wed Thu Fri Sat
13
       
2017
Months
Oct


Fri, Oct 13, 2017 10:59 pm

Checking the uptime for a Windows system using PowerShell

If you want to determine how long a Microsoft system has been running since it was last rebooted from a command-line interface (CLI), you can do so using PowerShell. You can do so by subtracting the last boot time from the current date and time. The Get-Date cmdlet shows the current date and time and (Get-CimInstance Win32_OperatingSystem).LastBootUpTime shows the last time the system was booted.

PS C:\Users\public\documents> (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

Tuesday, October 10, 2017 9:12:14 PM


PS C:\Users\public\documents> (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime


Days              : 3
Hours             : 1
Minutes           : 29
Seconds           : 26
Milliseconds      : 717
Ticks             : 2645667172021
TotalDays         : 3.06211478243171
TotalHours        : 73.4907547783611
TotalMinutes      : 4409.44528670167
TotalSeconds      : 264566.7172021
TotalMilliseconds : 264566717.2021



PS C:\Users\public\documents>

You can use the alias GCIM for Get-CimInstance to save some typing, if you wish.

PS C:\Users\public\documents> (GCIM Win32_OperatingSystem).LastBootUpTime

Tuesday, October 10, 2017 9:12:14 PM


PS C:\Users\public\documents>

[/os/windows/PowerShell] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo