Registry relevance with two unknown keys

Hey folks, back again with a relevance question. I am attempting to pull the value “FriendlyName” from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer\Port-1C\PORT_0, which works. However, those two port keys above may change from machine to machine in the above registry path. There are only a couple keys below the EdgeSer key, but they vary.
Below I show what is working and what is not. Please let me know if you have any ideas, thanks in advance.

The below is working

value "FriendlyName" of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer\Port-1C\PORT_0" of native registry

The below is not working. That Hardware ID below is a value in the Port_0 key above. I have used similar queries to the below for uninstall strings, but for this one, I cannot get it pull anything.

unique values of ((if (exists value "FriendlyName" of it AND exists value "HardwareID" of it) then (value "FriendlyName" of it as string) else (if (exists value "HardwareID" of it AND not exists value "FriendlyName" of it) then (value "HardwareID" of it as string & " | <N/A>") else nothings)) of keys whose (value "HardwareID" of it as string as lowercase starts with "edgebus\") of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of it) of (if x64 of operating system then (x64 registry;x32 registry) else registry)

`

Where are you finding the HardwareID starting with ‘edgebus’ ? Is it on the ‘Port-1C’ key, or ‘PORT_0’ key, or somewhere else?

You also don’t need to check ‘which’ registry. There’s no 32-bit redirection under HKLM\System, they all return the same thing.

I think you probably need the end of your query to be

keys whose (value "HardwareID" of it as string as lowercase starts with "edgebus\") of keys of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of it) of registry

In this structure

key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of it) of registry
gets us to
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer"

keys of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of it) of registry
gets us to
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer\Port-1C" (and every other child of EdgeSer )

Run these in the debugger, one at a time, so you can get a feel for the values returned by each before you start trying to add filtering

Q: pathnames of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of registry

Q: pathnames of keys of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of registry

Q: pathnames of keys of keys of keys "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\EdgeSer" of registry
2 Likes

Port_0 has the values that I need to query in my example, but both Port-1C and Port_0 will change depending on device.