All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Just setup Folder/File availability tests with %OldestFile% macro variable.
E.g. File of Folder name:
C:\data\%OldestFile%
Do not forget to enable "Translate macros" option.
Also enable "Tune Up reply value" option with variable: %FileTime%
Send e-mail (SMTP) action, assigned to this test item, should have mail template with %Reply% macro variable - it will contain date and time of oldest file.
Awesome thanks for the reply. I understand what you posted and i understand how the "Tune Up reply value" does and have read about it in the manual. However I cant figure out where to set that up. Where is it?
"Tune Up reply value" option is located on bottom of Test properties dialog (Optional status processing section).
This option can be hidden. Just click on [+] icon above the "Help" button.
Actually "Tune Up reply value" option is not necessary in this case.
You may simply use %FileTime% macro variable in mail template of Send e-mail (SMTP) action.
Option Explicit
On Error Resume Next
const statusUnknown = "scriptRes:Unknown:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
dim Fso, Folder, File, Path, objArgs, Wildcard, WA, p1, p2, oldest, objFile, k
Set objArgs = WScript.Arguments
if objArgs.Count < 1 then
WScript.StdOut.Write statusUnknown & "Expected parameters <Path\File Wildcard> E.g.: C:\logfiles\KN*.txt"
Wscript.Quit
end if
Path = objArgs(0)
WA = split(Path,"\")
Wildcard = WA(UBound(WA))
Path = ""
for k = Lbound(WA) to UBound(WA)-1
Path = Path & WA(k) & "\"
next
WA = split(Wildcard,"*")
p1 = WA(0)
p2 = WA(1)
Set fso = CreateObject("Scripting.FileSystemObject")
Set Folder = fso.getfolder(Path)
for Each File in Folder.Files
if (InStr(1, fso.GetFileName(File), p1, vbTextCompare) = 1) AND (InStr(1, fso.GetFileName(File), p2, vbTextCompare) > 0 ) then
Set objFile = fso.GetFile(File)
if oldest = "" then
Set oldest = objFile
else
if objFile.DateLastModified < oldest.DateLastModified then Set oldest = objFile end if
end if
end if
next
if oldest="" then
WScript.StdOut.Write statusOk & "no files found"
else
WScript.StdOut.Write statusBad & oldest.DateLastModified & " (" & oldest.Name & ")"
end if