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.

CodeFunctionName
What is this?

Public

Not Tested

Imported
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
0:22:49:37

Views 4,702

Downloads 1,390

CodeID
DB ID