Pulling an additional registry key using Discovery Probes

Steven Parker
Giga Sage

Is there a way to modify or create a new Discovery Probe that would run against computers/servers and pull a registry key we need for a particular piece of software?  I see a lot of documentation on Discovery Patterns and pulling keys, but not much on Discovery Probes.  Anyone have any insight or examples to go off of?


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
1 REPLY 1

Steven Parker
Giga Sage

For anyone coming to this thread in the future....this is how I accomplished pulling an individual registry key and populating it into a field on the CMDB Record.  This Community Post was extremely helpful:

https://community.servicenow.com/community?id=community_question&sys_id=14540369dbd8dbc01dcaf3231f96...

 

My steps to accomplish this:

The registry key I wanted a value from was this one in my example:

HKEY_LOCAL_MACHINE\SOFTWARE\Immunet Protect\guid

- Step 1 - Navigate to Discovery Definition -> Probes and search for "Windows - OS Information" probe

- Step 2 - In the "WMI Fields" related list, click New and create a new entry for the registry key you would like grab data from.  In my example, I wanted the "guid" key data from the "HKEY_LOCAL_MACHINE\SOFTWARE\Immunet Protect\"  directory:

find_real_file.png

 

This is how the related list will look once you complete this step:

find_real_file.png

-Step 3 - Now while still in the "Windows - OS Information" probe, navigate to the "Sensors" related list and click on the "Windows - OS Information" sensor to open it.

- Step 4 - Add the below code to the "Windows - OS Information" sensor.  Obviously, you will need to modify this for your registry key entry you want to pull and for the location on the CMDB record you want the data to go (right now I am just using short_description field).

Note - Replace the back slashes with "." in the directory of the registry key (regKey variable below).  The variable regKey should just be the directory path as well as you will add the actual final key/node in the variable below this (the guidValue variable in my example).

// This code is to grab the registry key guid for Immunet Protect (AMP)
// Reference: https://community.servicenow.com/community?id=community_question&sys_id=14540369dbd8dbc01dcaf3231f961923&view_source=searchResult

var regKey = "HKEY_LOCAL_MACHINE.SOFTWARE.Immunet Protect"; // need dots between the levels.
var node = g_disco_functions.findRegistryNode(result.Registry, regKey);
var guidValue = g_disco_functions.findNodeValueWithAttribute(node, "guid");
current.short_description = guidValue;

 

Here is the code once pasted in the "Windows - OS Information" sensor.  There may be a better location in the code, but this works fine:

find_real_file.png

 

This seems to work great!  I just wanted all this information to be in one place/comment if anyone were to look at this in the future.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven