Guys
I downloaded a script to show System Uptime for a Windows device but the output is in minutes. Please can you offer any advice how I can convert the time into Days/Hours/Minutes. My efforts using DateDiff and/or DatePart have failed
The script is below:
Thanks
--------------------------------------
"Insert funny comment in here!"
--------------------------------------
I downloaded a script to show System Uptime for a Windows device but the output is in minutes. Please can you offer any advice how I can convert the time into Days/Hours/Minutes. My efforts using DateDiff and/or DatePart have failed
The script is below:
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
dtmBootup = objOS.LastBootUpTime
dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
dtmSystemUptime = DateDiff("n", dtmLastBootUpTime, Now)
msgbox dtmSystemUptime
Next
Function WMIDateStringToDate(dtmBootup)
WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))
End Function
Thanks
--------------------------------------
"Insert funny comment in here!"
--------------------------------------