SSIS - WMI Event Watcher Task


As Stated here , we can use the WMI Event Watcher task for the following purposes:

  • Wait for notification that files have been added to a folder and then initiate the processing of the file.
  • Run a package that deletes files when the available memory on a server drops lower than a specified percentage.
  • Watch for installation of an application, and then run a package that uses the application.

In this article , let us see example for this scenario ( Wait for notification that files have been added to a folder and then initiate the processing of the file. ) :

Drag & drop WMI Event Watcher task from SSIS Toolbox on to the Control Flow tab .

Double click or right-click - > Edit ... - >  WMI Event Watcher Task Editor  - > WMI Options - > WmiConnection - >  try as shown below :


Under WMI Event Watcher Task Editor - > WqlQuerySource - > try as shown below :




The following WQL query watches for notification that a file has been added to a folder [  C:\WMIFileWatcher  ] :


SELECT * FROM __InstanceCreationEvent WITHIN 10 
WHERE TargetInstance ISA "CIM_DirectoryContainsFile" 
and TargetInstance.GroupComponent= "Win32_Directory.Name=\"c:\\\\WMIFileWatcher\"" 


Now execute the task - > WMI Event Watcher task will be in yellow color indicating the task execution in progress ( watches for notification whether a file has been added to a folder ) - >  




place any file into the folder " C:\WMIFileWatcher " - >  task execution will be completed .



Related Reference links :



See Also :


No comments: