3/02/2006

WQL and Path

I am playing around with WQL today. For a longest time, I couldn't get this query to work.


Set colFiles = objWMIService.ExecQuery ("SELECT * FROM CIM_DataFile" & _
" WHERE Drive = 'c:' AND Extension = 'mdb' And Path = '\windows\' ")


Have you noticed anything wrong with the query? It's the Path! I found that you need to use double back slash instead of single back slash. So, the correct Query should be like this.


Set colFiles = objWMIService.ExecQuery ("SELECT * FROM CIM_DataFile" & _
" WHERE Drive = 'c:' AND Extension = 'mdb' And Path = '\\windows\\' ")


Also, I found that if you have "!=" in your query, the query runs very very slowly.

0 Comments:

Post a Comment

<< Home