Output value of registry key as string

Hello everyone,

I am trying to create an analysis to read the value of a Registry Key for testing. For simplicity of testing I created the following in the fixlet debugger which outputs the value correctly.

q:(value "WordName" of it) of key "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\" of native registry
A: Word
T: 0.094 ms

I am trying to create an if then statement to detect the presence of a key and export the value if the key is present otherwise for error handling to just report N/A. Any ideas on where I’m going with my if-then statement? I have played around for a few hours to no avail.

q: if exist(value “WordName” of it) of key “HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word” of native registry then (value “WordName” of key “HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word”) as string else "N/A"
E: The operator “key” is not defined.

Thanks.

Your then statement needs the of native registry as well

Hi Alan,

Thanks for your reply. I was able to get the analysis working on my local machine using the debugger but when I run the Analysis globally it returns no results despite me adding the key to my machine. Have you ever encounter such as issue?

You are not getting values, because the BES Client has no Current User registry key. The “Current User” key is really an Alias that points to a key under the HKUsers branch of the Registry.

QnA will return a value because YOU are logged in.

BigFix has constructs to allow you to access the Current User key IF a user is logged into the computer.

Documentation for that is at: https://developer.bigfix.com/relevance/reference/registry.html#current-user-key-logged-on-user-of-registry-registry-key

Thank you @TimRice and @AlanM. I was going in circles but what you all have said makes total sense. :slight_smile: