Scott,
Assuming you are querying the local machine you can try:
lparameters ttCurrent
local loLocator, loService, loOSs, loOS, ltLastBoot, lcLastBoot
loLocator = createObject("wbemScripting.SwbemLocator")
loService = loLocator.ConnectServer()
loOSs = loService.ExecQuery("Select LastBootUpTime from Win32_OperatingSystem where Primary=true")
for each loOS in loOSs
lcLastBoot = loOS.LastBootUpTime
endfor
ltLastBoot = Ctot(Transform(Left(lcLastBoot, 14), '@R 9999-99-99T99:99:99'))
? lcLastBoot, ltLastBoot
return ltLastBoot
You'll need one of the following OSs for it to work:
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP4 and later.
Server: Included in Windows Server 2003, Windows 2000 Server, Windows NT Server 4.0 SP4 and later.
>Does anyone know how to return the time that a computer was booted or the amount of time a computer has been running since last reboot?
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges