This answer and VB script came from Roger "Microsoft Hopeless Guy" back in May 2013....
I have a question, how would you replace the "trace" file reference in the script with a specific file extension? I tried various ways, but unfortunately my code is not working.
I have a similar SCOM monitoring request as the original poster back in May 2013, but my user wants to be alerted when a file with a particular extension is created in a folder?
Any advice?
Thanks!
PS- the VB script is below...
===============
You may create time script monitor and the script is similar to
Dim fs, f, foldername,fd
set oAPI=CreateObject("MOM.ScriptAPI")
set oBag=oAPI.CreatePropertyBag()
Set fs = CreateObject("Scripting.FileSystemObject")
foldername="c:\temp"
status="OK"
Set fd = fs.Getfolder(foldername)
for each f in fd.files
if instr(f.name,"trace") then
status="NOT OK"
exit for
end if
next
Call oBag.AddValue("Status",status)
Call oAPI.Return(oBag)
IN this example, I assume the monitor file is c:\temp and the trace flle with file name "*trace*"
Roger