'* FORMAT TODAYS DATE THAT PART OF THE LOG FILE NAME
strYear = Year(TodayDT)
strMonth = Month(TodayDT)
strDay = Day(TodayDT)
if CInt(strMonth) < 10 then
strMonth = "0" & strMonth
end if
if CInt(strDay) < 10 then
strDay = "0" & strDay
end if
strToday = strYear & strMonth & strDay
' wscript.echo strToday
Set objFSo = CreateObject("Scripting.FileSystemObject")
pathname = "\\server\share\LOG for restarts_" & strToday & ".doc"
if objFSo.FileExists(pathname) then
Set objFile = objFSO.GetFile(pathname)
strTime = objFile.DateLastModified
if isdate(strTime) then
DT = cdate(strTime)
DTN = Now
if datediff("n",DT,DTN) > 10 then
wscript.echo "Last log entry over 10 minutes"
else
wscript.echo "The system is still alive"
end if
end if
else
'* If the log file was not found.
'wscript.echo "Log file not found"
'Send acommmand to the system
Set objShell = CreateObject("WScript.Shell")
varFile = Chr(34) & "C:\scripts\command.bat" & Chr(34)
objShell.run "C:\Windows\System32\cmd.exe /c " & varFile
Set objShell = Nothing
(...)
|