ServerUptime

Return how long the computer has been running.
Return format is dd:hh:mm:ss (from Seconds2Time function).
Tested on different computers, each one accurately displays the uptime. Originally by Rob R
Uses FileSystemObject to read the DateLastModified attribute from the pagefile.sys.

Function ServerUptime()
 Dim UptimeInSeconds
 Set fso = CreateObject("Scripting.FileSystemObject")
 Set PageFile = fso.GetFile ("C:\pagefile.sys") ' get the page
 UptimeInSeconds = DateDiff("S", PageFile.DateLastModified, Now()) ' Finds how many seconds between now and the pagefile mod date
 ServerUptime = Seconds2Time(UptimeInSeconds) ' Calls a function to format the seconds
 Set PageFile = Nothing
 Set fso = Nothing
End Function

? ServerUptime<br/>0:22:49:37

Views 1063 Downloads 324

'Seconds2Time', 'pagefile', 'uptime', 'up-time', 'server', 'FSO', 'FileSystemObject', 'NotMyWork'

ANmarAmdeen
333
Sessions Classic ASP
Revisions

v1.0