0

I'm using SSIS in Visual Stdio 2010 to check a specific folder for any csv files that are dropped in from a 3rd party where the filename begins with 'Despatch'. This is my WQL code:

   SELECT *
    FROM __InstanceCreationEvent WITHIN 5
    WHERE TargetInstance ISA 'CIM_DataFile'
        AND TargetInstance.Drive = 'E:'
        AND TargetInstance.Path = '\\Hybris URL REST Callbacks\\Despatched\\'
        AND TargetInstance.FileName LIKE 'Despatch%'
        AND TargetInstance.Extension = 'csv'

However, when I run it, I just get the error "Invalid parameter".

If I modify to the below it works - but how do I search for despatch* csv files only?

SELECT * FROM __InstanceCreationEvent WITHIN 10 
WHERE TargetInstance ISA "CIM_DirectoryContainsFile" 
and TargetInstance.GroupComponent= "Win32_Directory.Name=\"e:\\\\Hybris URL REST Callbacks\\\\Despatched\""

Where am I going wrong?

Regards,

Michael

Michael
  • 2,507
  • 8
  • 35
  • 71

2 Answers2

0

If anyone is interested I couldn't get this to work so using free SSIS file watcher addin:

http://www.sqlis.com/sqlis/post/File-Watcher-Task.aspx

Michael
  • 2,507
  • 8
  • 35
  • 71
0

It looks like you found another option, but if you decide to try this again it looks like the only problem was additional tabs/space in the first example you posted. After modifying it, I can run the following without any errors whereas before I was able to reproduce the same invalid parameter error.

SELECT * FROM __InstanceCreationEvent WITHIN 5 
WHERE TargetInstance ISA 'CIM_DataFile' AND TargetInstance.Drive = 'E:' 
AND TargetInstance.Path = '\\Hybris URL REST Callbacks\\Despatched\\' AND TargetInstance.FileName LIKE 'Despatch%' 
AND TargetInstance.Extension = 'csv'
userfl89
  • 4,610
  • 1
  • 9
  • 17