I have this code:
function Get-Uptime {
$o = Get-WmiObject -Class win32_operatingsystem
(Get-Date).date - $o.ConvertToDateTime($o.LastBootUpTime)
}
get-uptime
I have run this on 2 different Windows 7 machines. And the same thing happens each time. The output looks like this:
Days : 1
Hours : 9
Minutes : 28
Seconds : 3
Milliseconds : 874
Ticks : 1204838744010
TotalDays : 1.39448928704861
TotalHours : 33.4677428891667
TotalMinutes : 2008.06457335
TotalSeconds : 120483.874401
TotalMilliseconds : 120483874.401
But the output Never changes. I run this command 10 times in a row and nothing changes. How come? I have even closed PowerShell ISE opened it back up and the same is the same.