SQL Server Agent time-outs when an Alert is created that uses WMI

  • I am trying to create create a WMI event alert (that will start a SQL Server Agent job). However, when I try I get the following:

    Msg 22022, Level 16, State 1, Line 0

    The time-out was exceeded while the server waited for a response from SQL Server Agent. Make sure that the SQL Server Agent service is running

    Msg 14511, Level 16, State 1, Procedure sp_verify_alert, Line 237

    The @wmi_query could not be executed in the @wmi_namespace provided. Verify that an event class selected in the query exists in the namespace and that the query has the correct syntax.

    The WMI query looks like this:

    [font="Courier New"]SELECT *

    FROM __InstanceCreationEvent

    WITHIN 10

    WHERE TargetInstance ISA 'CIM_DataFile' AND TargetInstance.Name LIKE 'D:\\IMPORT\\RM\\TEST\\ChangeManagement_%'[/font]

    The namespace for the query is:

    [font="Courier New"]\\.\root\cimv2[/font]

    If I replace the 'LIKE' operator with '=' operator and rewrites the directory string without a wildcard I can get it to work sometimes, but just as often I get the same error as above.

    How can I get this to work?

    Thanks

    Johan

    PS.

    If I use the following query, that almost does what I want, the creation of the alert always work:

    [font="Courier New"]SELECT * FROM __InstanceCreationEvent WITHIN 10

    WHERE TargetInstance ISA 'CIM_DirectoryContainsFile'

    AND TargetInstance.GroupComponent = 'Win32_Directory.Name="D:\\\\IMPORT\\\\RM\\\\TEST"'[/font]

  • By using the other properties on TargetInstance (Drive, Path, Extension) I got the create script to work. However, I can't get the WMI event to fire when I drop files in the folder that the WMI event watches.

Viewing 2 posts - 1 through 2 (of 2 total)

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