There are numerous ways to find how long a machine has been powered on for, and below I will list a few of them:
CMD
systeminfo | find "System Boot Time"
net statistics server | find "Statistics since"
net statistics workstation | find "Statistics since"
Powershell
$LastBootUpTime = [System.Management.ManagementDateTimeConverter]::ToDateTime($(gwmi Win32_OperatingSystem).LastBootUpTime) $d = New-Timespan $LastBootUpTime (Get-Date) "{0} days {1} hours {2} minutes" -f $d.days,$d.hours,$d.minutes
Leave a Reply