WQL Query to use in WMI Event Watcher Task - watch for new file being added

  • Hi. I am trying to have a event watcher task monitor for when a specific file gets added to a directory on my windows 7 Enterprise machine 64bit (local). I am also running SQL SERVER 2008 R2 64bit version locally. The WQL statement is

    Select * from _InstanceCreationEvent within 30

    where targetinstance isa "CIM_DataFile"

    and targetinstance.name="C:\\adventureworks.bak"

    I get the following error when I run the package>

    [WMI Event Watcher Task] Error: Watching for the Wql query caused the following system exception: "Invalid class". Check the query for errors or WMI connection for access rights/permissions.

    The task is all I have in my package and it is supposed to trigger an event when a file get added to the directory (that event calls another package on my local file system). As I am not that familiar with WQL can someone tell me why this is not working as expected? What is a good resource to learn WQL as I did not find much with a Internet search.

    Thank you

    ----------------------------------------------------

  • Hi,

    Is there any one that can offer any advise?

    It would be much appreciated. Thank you 🙂

    ----------------------------------------------------

  • Would love to help but I have always done this sort of thing through a C# script task in the package. It just looks at a directory and sees if the file is there. If it exists then sets a package variable to true and the next step is accessed by a precedence constraint that say previous task is successful and the variable = true.

    E

    😎

  • Thanks Ells. I will try that suggestion, using a script task with a variable. I was just curious if there was some issue with the query I have and why it errors. It looks fine to me syntax wise. I am thinking it has something to do with the version of Windows I am using, just my guess.

    ----------------------------------------------------

  • Konesans have a File Watcher custom component. Perhaps you could give that a try?

    Regards

    Lempster

  • use Konesan's file Watcher task. google for it; its on the SQLIS site somewhere

  • Thanks for your responses. I am also looking for a good resource on WQL, if anyone has any suggestions.

    Thanks.

    ----------------------------------------------------

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply