Sometimes I miss my Unix system. Actually, that’s not true, sometimes I miss the tools that are available. For example, I needed to figure out when the system booted. Thankfully, there are performance counters that can tell me!
PS# cat get-uptime.ps1 $PCounter = "System.Diagnostics.PerformanceCounter" $counter = new-object $PCounter System,"System Up Time" $value = $counter.NextValue() $uptime = [System.TimeSpan]::FromSeconds($counter.NextValue()) "Uptime: $uptime" "System Boot: " + ((get-date) - $uptime)