troubleshooting Question

VB Script - File Monitoring

Avatar of Rupert Eghardt
Rupert EghardtFlag for South Africa asked on
VB ScriptMicrosoft DevelopmentWindows OS
2 Comments1 Solution380 ViewsLast Modified:
Hi Guys,

I have a working VB Script - sending an e-mail.  (Please see script below)
I would like to modify the script to include a conditional trigger.

The script will be called every 5 minutes from Windows Task Scheduler, but should only trigger an e-mail, if a "file being monitored" is older than 15 minutes.

For example:  We have a reporting tool, writing a file to:  C:\OUTPUT\Report.PDF

We need an e-mail notification, if the time-stamp of the file (Report.PDF) is older than 15 minutes (Thus not replaced or updated)

My Current Working VB Script:

on error resume next
Const schema   = ""
Const cdoBasic = 1
Const cdoSendUsingPort = 2
Dim oMsg, oConf
' E-mail properties
Set oMsg      = CreateObject("CDO.Message")
oMsg.From     = ""  ' or "Sender Name <>"
oMsg.To       = ""    ' or "Recipient Name <>"
oMsg.Subject  = "Messaging Script"
oMsg.TextBody = "Messaging Script"
' GMail SMTP server configuration and authentication info
Set oConf = oMsg.Configuration
oConf.Fields(schema & "smtpserver")       = "" 'server address
oConf.Fields(schema & "smtpserverport")   = 587              'port number
oConf.Fields(schema & "sendusing")        = cdoSendUsingPort
oConf.Fields(schema & "smtpauthenticate") = cdoBasic         'authentication type
oConf.Fields(schema & "smtpusessl")       = "False"             'use SSL encryption
oConf.Fields(schema & "sendusername")     = "" 'sender username
oConf.Fields(schema & "sendpassword")     = "Password"      'sender password
' send message
' Return status message
If Err Then
    resultMessage = "ERROR " & Err.Number & ": " & Err.Description
    resultMessage = "Message sent ok"
End If
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros