-
Time since last boot (Windows, VBScript)
I don’t remember where I found this, I was just happy to find code that did this. strComputer = "." ‘ Local computer set objWMIDateTime = CreateObject("WbemScripting.SWbemDateTime")set objWMI = GetObject("winmgmts:\" & strComputer & "rootcimv2")set colOS = objWMI.InstancesOf("Win32_OperatingSystem")for each objOS in colOS objWMIDateTime.Value = objOS.LastBootUpTime Wscript.Echo "Last Boot Up Time: " & objWMIDateTime.GetVarDate & vbcrlf &…