Thursday, 25 December 2014

WMI Event Watcher Task

The WMI Event Watcher task watches for a Windows Management Instrumentation (WMI) event using a Management Instrumentation Query Language (WQL) event query to specify events of interest. You 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.

Step by Step WMI Event Watcher Task

Take WMI Event Watcher Task 

Double click on WMI Event Watcher Task. Create new WMI connection.

Write the connection name and description. Use windows Authentication. Click test button.
Click ok.

Select WQLQuerySource type

Click on WQLQuerySource

Write the WQL query
Here I am writing the query for Event watcher. Where a file paste a file or deleting form the folder E:\NewFiles\ then Event will be fire. In this example I am going the show the message when anyone doing any operation on the give location.
SELECT * FROM __InstanceCreationEvent WITHIN 10  WHERE TargetInstance ISA "CIM_DirectoryContainsFile"  AND TargetInstance.GroupComponent = "Win32_Directory.Name=\"E:\\\\NewFiles\""

Click Ok.

After that I am taking script task where I will display the message.

Now I am executing the package.

When we execute the package it will be show yellow till I do not do any file operation on that location.



There is no file here
Now I am going to paste a file on that location.

Now see the Package


You will the message.

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts