I have a challenge where I want to use a GPO to set a Power Plan.
Working on constructing a WMI Filter (using WQL), I ran into a problem of determining a set of WQL statements that would always return true
for desktops/servers and false
for laptops/notebooks.
I began by testing the use of win32_systemenclosure
property ChassisTypes
, but quickly found that ChassisTypes
is an int array
, which can not be used in (standard) WQL [although it's available in the SCCM WQL extension set].
Next I found references to use win32_battery
and check the Status
property for a non-zero value; but I quickly realized that this will return a value on desktops and servers that have a UPS attached via USB.
Since none of the above will always (+/- tolerable N) return true
for desktops/servers, and false
for laptops/notebooks, I located the win32_portablebattery
class.
Excited, I began testing and quickly noticed that win32_portablebattery
returns nothing when executed against a desktop or server. By "nothing" I don't mean {empty string}/""
, I don't mean NULL
, and I don't mean false
, I mean literally nothing. I have even attempted to check __CLASS = ""
and __CLASS IS NULL
and both still return false
for desktops and servers.
Does anyone know any further WQL
-fu to try to get a true
results using win32_portablebattery
?