i’m doing a pretty simple analysis looking for a particular video card model. the following gives me true/false if the card is present:
((string value of property "Name" of it) of (select object "Name from Win32_VideoController" of wmi)) as lowercase contains "AMD Radeon HD6540" as lowercase
However, if a machine has two of these cards, my results column shows error and when hovering over it, i see something like:
True
Singular expression refers to non-unique object.
This just makes it difficult to sort the results. If i change object to objects I get errors that the left operand of ‘contains’ must be singular. Any tips on how to return just a simple true/false regardless if there are multiple cards?
Looks like it worked with one small change, object to objects:
exists ((string value of property "Name" of it) of (select objects "Name from Win32_VideoController" of wmi)) whose (it as lowercase contains "AMD Radeon HD 6450" as lowercase)
In fixlet debugger this outputs True on a machine with dual cards. Thanks!!
This should give you the names of all of the video cards in the system:
string values of properties "Name" of select objects "Name from Win32_VideoController" of wmis
This uses plural relevance all throughout to suppress errors.
This will filter the above to a particular model only, and then use exists to return a true/false value:
exists string values whose(it as lowercase contains "AMD Radeon HD 6450" as lowercase) of properties "Name" of select objects "Name from Win32_VideoController" of wmis
This is equivalent to the relevance that is working for you, but the advantage of this is that it is based upon the same relevance that you would use in an analysis property for reporting the names of all of the GPUs in the system with only a slight addition. It is also a bit simplified.
This should give you the number of GPUs in the system:
number of string values of properties "Name" of select objects "Name from Win32_VideoController" of wmis