Megosztás a következőn keresztül:


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.

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.

WQL Queries

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.

Note

WMI classes vary between versions of Windows. These sample queries are valid in Windows XP, but may not be valid in earlier versions of Windows.

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\"" 

Integration Services includes a task that reads WMI information.

For more information about this task, click the following topic:

Custom Logging Messages Available on the WMI Event Watcher Task

The following table lists the custom log entries for the WMI Event Watcher task. For more information, see Implementing Logging in Packages and Custom Messages for Logging.

Log entry

Description

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.

Configuring the WMI Event Watcher Task

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:

Configuring the WMI Event Watcher Task Programmatically

For more information about programmatically setting these properties, click the following topic:

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.