Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

closed as off-topic by Sven Jan 10 at 12:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

You can write a service using the .NET class FileSystemWatcher. More information is available at this question.

share|improve this answer
    
and or just create a simple wmi query using the ISA event notification process. still trying to find a good easy example will post when I find one. –  tony roth Jul 1 '11 at 20:39
    
@tony roth: Interesting. I'm curious to see your example. –  surfasb Jul 1 '11 at 23:27
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
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.