That’s because it could never work.
This is not written correctly and will never actually do anything except for return the literal string name from win32_VideoController
. This relevance statement is effectively saying, “If WMI
exists, then return the string name from win32_VideoController
”
Q: ("name from win32_VideoController")of WMI
A: name from win32_VideoController
T: 6.074 ms
I: singular string
See this example:
Q: ("Hello World!")of WMI
A: Hello World!
T: 9.276 ms
I: singular string
You need to make sure the WMI query actually returns the correct/expected value before trying to compare it to Intel(R) HD Graphics 4600
See here:
Q: selects "name from win32_VideoController" of WMIs
A: Name=Microsoft Hyper-V Video
T: 38.336 ms
I: plural wmi select
Notice that the type info is plural wmi select
and not singular string
. This mean is is a result of a WMI Select and not just a string. This means it has properties that are particular to the type wmi select
than can be used.
This will get just the string result so that it can be used in a comparison:
Q: string values of selects "name from win32_VideoController" of WMIs
A: Microsoft Hyper-V Video
T: 47.574 ms
I: plural string
Then to get the true/false value from a plural result, use whose:
Q: exists string values whose("Microsoft Hyper-V Video" = it) of selects "name from win32_VideoController" of WMIs
A: True
T: 48.344 ms
I: singular boolean
All of this is a very long way of saying, don’t start with trying to get a boolean result. Start by getting the string value you want to compare, THEN turn that into a boolean result. If you start with trying to get a boolean result, it can easily lead you down the wrong path.
For instance, the following will always be true:
Q: exists "Intel(R) HD Graphics 4600"
A: True
T: 0.095 ms
I: singular boolean
It only asserts that the literal string exists, which it always will, on every computer and OS.
This is how to get the raw data from WMI:
selects "* from win32_VideoController" of WMIs
This is how to get just the name,driverversion,DriverDate:
Q: selects "Name,DriverVersion,DriverDate from win32_VideoController" of WMIs
A: DriverDate=20060621000000.000000-000
A: DriverVersion=10.0.10586.0
A: Name=Microsoft Hyper-V Video
T: 49.127 ms
I: plural wmi select
This is how to get them together as a single result:
Q: (string value of property "Name" of it & " = " & string value of property "DriverVersion" of it) of select objects "Name,DriverVersion from win32_VideoController" of WMIs
A: Microsoft Hyper-V Video = 10.0.10586.0
T: 41.647 ms
I: plural string
References: