WMI Event Watcher Task
Applies To: SQL Server 2016
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.
Integration Services includes a task that reads WMI information.
For more information about this task, click the following topic:
WQL is a dialect of SQL with extensions to support WMI event notification and other WMI-specific features. For more information about WQL, see the Windows Management Instrumentation documentation in the MSDN Library.
The following query watches for notification that the CPU use is more than 40 percent.
SELECT * from __InstanceModificationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_Processor' and TargetInstance.LoadPercentage > 40
The following query watches for notification that a file has been added to a folder.
SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA "CIM_DirectoryContainsFile" and TargetInstance.GroupComponent= "Win32_Directory.Name=\"c:\\\\WMIFileWatcher\""
|WMIEventWatcherEventOccurred||Indicates that an event occurred that the task was monitoring.|
|WMIEventWatcherTimedout||Indicates that the task timed out.|
|WMIEventWatcherWatchingForWMIEvents||Indicates that the task began to execute the WQL query. The entry includes the query.|
You can configure the WMI Data Reader task in the following ways:
Specify the WMI connection manager to use.
Specify the source of the WQL query. The source can be external to the task, a variable or a file, or the query can be stored in a task property.
Specify the action that the task takes when the WMI event occurs. You can log the event notification and the status after the event, or raise custom Integration Services events that provide information associated with the WMI event, the notification, and the status after the event.
Define how the task responds to the event. The task can be configured to succeed or fail, depending on the event, or the task can just watch for the event again.
Specify the action the task takes when the WMI query times out. You can log the time-out and the status after time-out, or raise a custom Integration Services event, indicating that the WMI event timed out and logging the time-out and time-out status.
Define how the task responds to the time-out. The task can be configured to succeed or fail, or the task can just watch for the event again.
Specify the number of times the task watches for the event.
Specify the time-out.
If the source is a file, the WMI Event Watcher task uses a File connection manager to connect to the file. For more information, see Flat File Connection Manager.
The WMI Event Watcher task uses a WMI connection manager to connect to the server from which it reads WMI information. For more information, see WMI Connection Manager.
You can set properties through SSIS Designer or programmatically.
For more information about the properties that you can set in SSIS Designer, click one of the following topics:
For more information about how to set these properties in SSIS Designer, click the following topic:
For more information about programmatically setting these properties, click the following topic: