why does this expression using ‘contains’ work, but ‘does not contain’ returns incorrect results ?
WORKS - exists (string values whose (it as lowercase contains “USB” as string as lowercase) of selects “InterfaceType FROM Win32_DiskDrive” of wmi)
INCORRECT RESULTS - exists (string values whose (it as lowercase does not contain “USB” as string as lowercase) of selects “InterfaceType FROM Win32_DiskDrive” of wmi)
Because you’re testing the result of a query that is returning something…which it is. Be careful about just using exists on a result, versus using where you are just testing whether it’s posible to ‘get’ a result. (e.g., “exists wmi” tests whether you have wmi capabilities VS “exists (values from “blah blah query” of wmi)” which just tests for any result at all, or nothing returned)
On my machine, the relevance returns two results: “USB” and “IDE”. The first query returns “USB”, for which exists = True and the second returns “IDE”, for which exists = True.
I would remove the whose statement and put a check in afterwards that tests whether the result contains (or does not) the item:
(it contains “USB”) of concatenation of (string values of selects “InterfaceType FROM Win32_DiskDrive” of wmi)