Is there a way for a script to send me an email message anytime a particular
file is modified? I already have code to send an email alert - I just need
the logic that periodically checks the file and sends the alert if it has
been modified.

Re: Send email alert when file is modified by Trevor

Trevor
Wed Oct 11 20:41:29 CDT 2006

D.P. Roberts wrote:
> Is there a way for a script to send me an email message anytime a particular
> file is modified? I already have code to send an email alert - I just need
> the logic that periodically checks the file and sends the alert if it has
> been modified.
>
>

Theoretically, yes, although I've had trouble getting it to work. You'll
want to create a WMI event filter using the __InstanceOperationsEvent
system class that points to the CIM_DataFile class. Then, create an
instance of the ActiveScriptEventConsumer in the root\default namespace,
I believe, and an instance of the FilterToConsumerBinding to fire off
the e-mail script.

There's a lot of information available at the Technet Script Center,
including this article:

http://www.microsoft.com/technet/community/columns/scripts/sg0103.mspx

Trevor Sullivan
MCP

Re: Send email alert when file is modified by Fosco

Fosco
Wed Oct 11 23:49:59 CDT 2006

D.P. Roberts:
> Is there a way for a script to send me an email message anytime a particular
> file is modified? I already have code to send an email alert - I just need
> the logic that periodically checks the file and sends the alert if it has
> been modified.

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("C:\WINDOWS\WIN.INI")
s= f.DateLastModified
msgbox s
msgbox "sto' monitorando in background"
do until f.DateLastModified > s
wscript.sleep 100
Loop
msgbox "Attenzione Win.ini e' stato modificato"


''''
http://www.ostrosoft.com/smtp_component.asp
http://www.ostrosoft.com/smtp_component/smtp_vbscript.zip

--
Fosco