Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '15 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.

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""'")

    Set objLatestEvent = colMonitoredEvents.NextEvent
    Wscript.Echo objLatestEvent.TargetInstance.PartComponent
share|improve this answer

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