Does anyone know of a tool were that is service based which I would be able to run a script every time a file arrives in a directory? I would write the script all I want is the tool to be a service based application.
|
feedback
|
|
You can write a service using the .NET class FileSystemWatcher. More information is available at this question. | |||||
feedback
|
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("Select * From __InstanceCreationEvent Within 5 Where " _
& "Targetinstance Isa 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\scripts""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
Loop
| ||||
|
feedback
|