Relevance for PnPCapabilities

We have a fixlet to disable the NIC option “Allow the computer to turn off this device to save power”. The relevance is failing with error “Error: Singular expression refers to non-unique object.”

We have multiple NICs on most of these servers. How do we get fix the relevance so it’s succeeds if there’s a single adapter or multiple and comes back true whether one NIC or multiple are set to Enabled?

(exists “PnPCapabilities” of ((it) of keys of (key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry))) AND (exists values “PnPCapabilities” of ((it) of keys of (key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry))) AND (value “PnPCapabilities” of ((it) of keys of (key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry))) != 280

I can’t test this, but does this work?

(disjunction of ((exists “PnPCapabilities” of ((it) of keys of (key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry))); (exists values “PnPCapabilities” of ((it) of keys of (key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry))); (value “PnPCapabilities” of ((it) of keys of (key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry))) != 280))

*edited to include collections

This part at the beginning isn’t doing what you think…it’s checking whether the string “PnPCapabilities” exists, not whether a value of that name exists (so this part is always True if the key exists regardless of whether the value exists in it)

This part also may not be what you expect - PnPCapabilities is a bitmapped value. I think power saving is only one (or maybe two) of those bits, while the rest of the bits reflect other capabilities (like maybe hot-swappable PCI slots or USB interfaces, etc). So you probably need to identify which bits are involved in power saving mode and just compare those bits .

1 Like

I’m not sure what condition you want to return True on -

  • Any with power saving enabled
  • Any with power saving disabled
  • All have power saving enabled
  • All have power saving disabled

True if “there’s a single adapter or multiple and comes back true whether one NIC or multiple are set to Enabled”

This article is old, but I think still valid:

Adapter with PnPCapabilities not present or set to 0:
image

Adapter with PnPCapabilities set to decimal 16:
image

Adapter with PnPCapabilties set to decimal 24:
image

Adapter with PnPCapabilities set to decimal 256:
image

From the article:

You have three options for the power management properties of the Network Card:

Option 1: Allow the computer to turn off this device to save power
Option 2: Allow this device to wake the computer
Option 3: Only allow a magic packet to wake the computer
The different possible combinations that exist along with their DWORD values (in decimal and hex) are:

Option 1 and option 2 are checked, Option 3 is unchecked: This combination is default and hence its value is 0.
Option 1, option 2, and option 3 are all checked: The value becomes 0x100 (256).
Only option 1 is checked: The value becomes 0x110 (272).
Option 1 is unchecked (Note that option 2 and option 3 will be greyed out as a result): The value becomes 0x118 (280).

I don’t think 280 is an expected state? But it’s not really clear to me from the article.

In any case, if you’re sure you want to find a 280 in there, I think this query can be a bit simplified

q: exists values "PnPCapabilities" whose (it as integer != 280) of keys of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}" of registry

1 Like

I’m looking for ANY, not ALL, with option 1 unchecked. I didn’t create that relevance, I was just asked to see why it’s not working. I believe they took that from some built in relevance.

This worked perfectly. If ANY adapter has that option checked it will have a something other than 280 and will be relevant. If it’s 280 then it’s false and not relevant.
exists values “PnPCapabilities” whose (it as integer != 280) of keys of keys “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry

Thank you again for your help!

1 Like

I want to add another condition without breaking this. You can see in the image below there are several keys with the same GUID name ending in 318. How do we filter out so only if this GUID has class = net?

So I want that added before this.
exists values “PnPCapabilities” whose (it as integer != 280) of keys of keys “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E972-E325-11CE-BFC1-08002bE10318}” of registry

What is the best way to go about that? Use IF statement or two conditions with AND?

The good news, is that GUID is always the Net class.

Those GUIDs are not random, each GUID under Control\Class is for a specific class of devices.

It’s not always Net, which is why we are having a problem. The fixlet turned off the power saving option but the relevance is still true.

We want to filter out all the noise and only search this GUIDs subkey when the class equals net.

But…the guid in your screenshot does not match the GUID you’re searching here. So what is your actionscript doing?

Good catch, I completely missed that. I looked at the action script, which was create a couple years ago by someone else, and the problem is that they created it wrong. It’s doing REG_SZ instead of DWORD.

1 Like