You may also have a glance for the future at 
http://fwutilities.sourceforge.net/.<http://fwutilities.sourceforge.net/>
I used this a few times, and its stable, never missed a beat and very 
configurable...

Given it uses Windows services, you can let built in facilities to recover it, 
but it wont need it...

jlc

________________________________
From: Sam Cayze [[email protected]]
Sent: Friday, October 07, 2011 12:37 PM
To: NT System Admin Issues
Subject: Script Help Please? Runs for a few weeks, then stops

I have this script that runs in the background on a W2K3 Server that triggers 
an action on a Folder Change Event.  It will work for weeks, and then stops 
working (even though the script is still running in Task Manager).  I think it 
might also intermittently miss some triggers too. As soon as I kill it and 
re-run it, it works fine.

Could any eyes with some free time glance it over and offer any suggestions?
Sure, I could just auto-restart it every few days, but I’d rather do it right.

Thanks!

-Sam


sComputer = "."
sPath = ""

Set objWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery ("SELECT * FROM 
__InstanceCreationEvent WITHIN 2 WHERE " _
        & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
            & "TargetInstance.GroupComponent= " _
                & 
"'Win32_Directory.Name=""D:\\\\Inetpub\\\\ftproot\\\\PPower""'")

'Wscript.Echo vbCrlf & Now & vbTab & "Begin Monitoring for a Folder Change 
Event..." & vbCrlf

Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Select Case objLatestEvent.Path_.Class

Case "__InstanceCreationEvent"
'WScript.Echo Now & vbTab & objLatestEvent.TargetInstance.PartComponent & " was 
created" & vbCrlf

'Cleanup sPath so it can be passed to .AddAttachment without quotes and the 
double //
sPath = split(objLatestEvent.TargetInstance.PartComponent,"=")(1)
sPath = REPLACE(sPath, "\\", "\")
sPath = REPLACE(sPath, Chr(34), "")
'WScript.Echo sPath

           'Mail Section
           Set objMessage = CreateObject("CDO.Message")
           objMessage.Subject = "Purchasing Power Upload Alert"
           objMessage.From = """WEB-FTP"" <[email protected]>"
           objMessage.To = "[email protected]"
           objMessage.AddAttachment sPath
           objMessage.TextBody = "A new file has been uploaded to the FTP Site" 
_
           & vbCRLF & vbCRLF & Now & vbTab & sPath & vbCRLF _
           & vbCRLF & "See attached file, or connect to the FTP Site: " & 
"ftp://ftp.rollouts.com/ppower/";

           objMessage.Configuration.Fields.Item _
           ("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2
           objMessage.Configuration.Fields.Item _
           ("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = 
"mail.rollouts.com"
           objMessage.Configuration.Fields.Item _
           ("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 
25
           objMessage.Configuration.Fields.Update
           objMessage.Send
           'Testing:
           'script.Echo objMessage.TextBody


End Select
Loop

Set objWMIService = nothing
Set colMonitoredEvents = nothing
Set objLatestEvent = nothing
__________________________

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to