I am trying to get specific keys that are located in different branches of the registry below HKLM\Software\Autodesk. I don’t know each of the specific branch paths and am searching the registry for the values.
Unfortunately the 4 keys being looked for may not exist for each product. And there are lots of branches that don’t have these keys at all.
This analysis script works but provides a blank line in the analysis report for each branch that doesn’t have the keys.
((if(exists value “ProductName” of it) then (value “ProductName” of it as string)else “”) & (if(exists value “SerialNumber” of it) then (" - " & value “SerialNumber” of it as string)else “”) & (if(exists value “Release” of it) then (" - " & value “Release” of it as string)else “”) & (if(exists value “StandaloneNetworkType” of it) then (" - " & value “StandaloneNetworkType” of it as string)else “”)) of (it;keys of it; keys of keys of it; keys of keys of keys of it; keys of keys of keys of keys of it) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk” of registry
Is there a way to record only branches that have some data or that have a ProductName?
q: ((if(exists value “ProductName” of it) then (value “ProductName” of it as string)else “”) & (if(exists value “SerialNumber” of it) then (" - " & value “SerialNumber” of it as string)else “”) & (if(exists value “Release” of it) then (" - " & value “Release” of it as string)else “”) & (if(exists value “StandaloneNetworkType” of it) then (" - " & value “StandaloneNetworkType” of it as string)else “”)) of (it;keys of it; keys of keys of it; keys of keys of keys of it; keys of keys of keys of keys of it) whose (exists value “ProductName” of it) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk” of registry
Or… simplified with new BigFix “|” operator in 8.0:
q: ((value “ProductName” of it as string | “”) & " - " & (value “SerialNumber” of it as string | “”) & " - " & (value “Release” of it as string | “”) & " - " & (value “StandaloneNetworkType” of it as string|"")) of (it;keys of it; keys of keys of it; keys of keys of keys of it; keys of keys of keys of keys of it) whose (exists value “ProductName” of it) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk” of registry