Posted on 2013-12-03
Can someone explains line by line...i know it just try to get the uptime but need explanation and i want to knw what it does...
$computer = read-host "Please type in computer name you would like to check uptime on"
$lastboottime = (Get-WmiObject -Class Win32_OperatingSystem -computername $computer).LastBootUpTime
$sysuptime = (Get-Date) – [System.Management.ManagementDateTimeconverter]::ToDateTime($lastboottime)
Write-Host "$computer has been up for: " $sysuptime.days "days" $sysuptime.hours "hours" $sysuptime.minutes "minutes" $sysuptime.seconds "seconds"