urkec replied to ewm
13-Nov-09 11:30 AM

If you look at the Cim_DirectoryContainsFile class you will see that it only
has two properties:
GroupComponent, representing the path to a Win32_Directory instance
PartComponent, representing the path to a CIM_DataFile instance
This is why your query does not work - there is no Extension property for
Cim_DirectoryContainsFile. This does not work either:
TargetInstance.PartComponent.Extension
because PartComponent (just as GroupComponent) contains just a path (as a
string). Here is an alternative query:
Select * From __InstanceCreationEvent Within 10 Where TargetInstance Isa
Cim_DataFile And TargetInstance.Drive = "C:" And TargetInstance.Path =
Instead of Cim_DirectoryContainsFile, this query subscribes to Cim_dataFile
creation events, which allows you to rafine results using all Cim_dataFile
properties, including Extesion.
--
urkec
My blog:
http://theadminblog.blogspot.com/
My CodeProject articles:
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=4210975