Re: why does this wmi query take 10 minutes on a dual proc 2GB memory raid 1 15K scsi server?



Well - I solved my issue. I'm not sure if changing the class I'm
querying shortened the time (since CIM_DataFile inherits everything
from CIM_LogicalFile) but I'm sure that adding the drive and path is
what totally sped up the query. Anyway - for anyone having performance
issues when doing a WMI wql query with a wildcard search because
file.exists can't handle or support a wildcard (without loading into an
arry and iterating) - here is what you do:

Select * From CIM_LogicalFile Where Drive = 'c:' AND Path = '\\"&
server & "\\Backups\\' AND Name LIKE '%" & myVar & "%'

where server is obvious, and myVar is the known part of the file I was
searching for. You don't have to use those variables, it was just
easier for me. But be sure to give it a drive and a path if possible.
Otherwise it's going to take a while.

This query above only takes 5 seconds at the most, whereas my first
post took 10 - 15 minutes.

Oh - and it's always best to test it through a wbemtest query before
running the script, because the "close" button works great to terminate
a long running query. I guess you could endtask on wmiprvse.exe, but
why bother?

Oh and one other thing, you must escape under_scores if they're in your
filename, like [_]. But if you're like me, you don't do bushleague
filenaming practices like that.

.


Loading