Configuring registry keys in the inventory
1. Objective
This configuration allows you to define the Windows registry keys to be captured by the computer agent and reported during inventory.
2. Server configuration
Two changes are required here: one for agents already installed and one for future computers.
Configuration for agents already installed:
Edit the file:
/etc/mmc/plugins/inventoryconf.ini
Edit the following file to update existing workstations:
/var/lib/pulse2/xmpp_baseplugin/plugin_updatesettings.py
Example (line 20):
param_1 = "del@__@startupdate.ini@__@plugins@__@liststartplugin"
param_2 = "add@__@inventoryconf.ini@__@parameters@__@reg_key_1@__@HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled"
param_3 = "add@__@inventoryconf.ini@__@parameters@__@reg_key_2@__@HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProductName|WindowsVersion"
nb_params = 3
Configuration for future workstations:
Edit the file:
/var/lib/pulse2/client/inventory.ini
Regenerate the agent:
/var/lib/pulse2/client/generate-pulse-agent.sh
Add or modify the [parameters] section:
[parameters]
# Registry keys that need to be pushed in an inventory
# Format:
# reg_key_x = path_to_key|key_label_shown_in_mmc
# Exemple :
# reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
# reg_key_2 = HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProductName|WindowsVersion
# Nombre total de clés configurées
# max_key_index = 2
reg_key_1 = \chemin\vers\la\cle|nom à associer
Key format
Each key must follow this format:
reg_key_X = key_path|display_name
Example:
reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
reg_key_1: identifier of the key to capture.HKEY_LOCAL_MACHINE\...: path to the Windows registry key.LUAEnabled: name associated with the key, used to identify it in the interface.
3. max_key_index parameter
The parameter:
max_key_index = 2
corresponds to the number of configured registry keys.
For example, for two keys:
reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
reg_key_2 = HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProductName|WindowsVersion
max_key_index = 2
For three keys:
reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
reg_key_2 = HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProductName|WindowsVersion
reg_key_3 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\...|MaCle
max_key_index = 3
Important:
max_key_indexmust match the last index used in the configuration.
4. Special case: HKEY_CURRENT_USER
When a key is located in:
HKEY_CURRENT_USER
the relevant user must be specified using the parameter:
current_user = user_name
Example:
[parameters]
reg_key_1 = HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\...|MaCle
max_key_index = 1
current_user = monUser
In this example, the key will be searched for in the user's profile:
monUser
Why specify current_user?
HKEY_CURRENT_USER depends on the currently loaded user profile.
The parameter:
current_user = monUser
therefore tells the agent which user to use when retrieving keys from HKEY_CURRENT_USER.
For keys located in
HKEY_LOCAL_MACHINE, thecurrent_userparameter is not required.
5. Complete example
Here is an example with two registry keys:
- A key located in
HKEY_LOCAL_MACHINE - A key located in
HKEY_CURRENT_USER
[parameters]
# Registry keys that need to be pushed in an inventory
reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
reg_key_2 = HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced|Exemple
max_key_index = 2
current_user = siveo
6. Example using only HKEY_LOCAL_MACHINE
If all the keys to be retrieved are located in HKEY_LOCAL_MACHINE, the configuration can be performed without current_user.
[parameters]
reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
reg_key_2 = HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProductName|WindowsVersion
max_key_index = 2
7. Example using only HKEY_CURRENT_USER
If the keys are located in HKEY_CURRENT_USER, you must specify the relevant user.
[parameters]
reg_key_1 = HKEY_CURRENT_USER\Software\MonApplication\Configuration\Version|ApplicationVersion
reg_key_2 = HKEY_CURRENT_USER\Software\MonApplication\Configuration\Mode|ApplicationMode
max_key_index = 2
current_user = siveo
8. Relevant GLPI tables
The data collected from the registry keys is stored in various GLPI tables.
For GLPI 10.0, the relevant tables are as follows.
8.1. Collect
| Plugin | Table |
|---|---|
| FusionInventory | glpi_plugin_fusioninventory_collects |
| GLPI Inventory | glpi_plugin_glpiinventory_collects |
8.2. Registries
| Plugin | Table |
|---|---|
| FusionInventory | glpi_plugin_fusioninventory_collects_registries |
| GLPI Inventory | glpi_plugin_glpiinventory_collects_registries |
8.3. RegContent
| Plugin | Table |
|---|---|
| FusionInventory | glpi_plugin_fusioninventory_collects_registries_contents |
| GLPI Inventory | glpi_plugin_glpiinventory_collects_registries_contents |
8.4. Table mappings
Depending on the plugin used, the tables are therefore different.
FusionInventory
glpi_plugin_fusioninventory_collects
glpi_plugin_fusioninventory_collects_registries
glpi_plugin_fusioninventory_collects_registries_contents
GLPI Inventory
glpi_plugin_glpiinventory_collects
glpi_plugin_glpiinventory_collects_registries
glpi_plugin_glpiinventory_collects_registries_contents
The tables to use depend on the inventory plugin used in the environment.
9. Database verification
To verify the presence of the tables:
SHOW TABLES LIKE '%collect%';
To verify the tables related to the registries:
SHOW TABLES LIKE '%registr%';
It is also possible to check the relevant tables directly:
SHOW TABLES LIKE 'glpi_plugin_glpiinventory_collects%';
or:
SHOW TABLES LIKE 'glpi_plugin_fusioninventory_collects%';
10. Example of a complete configuration
Example with two keys:
[parameters]
# Registry keys that need to be pushed in an inventory
# Key permettant de récupérer l'état de l'UAC
reg_key_1 = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA|LUAEnabled
# Key permettant de récupérer le nom du produit Windows
reg_key_2 = HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProductName|WindowsVersion
# Nombre de clés configurées
max_key_index = 2
The values will then be reported during the computer agent inventory.
11. Summary
| Parameter | Role |
|---|---|
reg_key_1 |
First registry key to capture |
reg_key_2 |
Second registry key to capture |
reg_key_X |
Additional registry key |
max_key_index |
Total number of configured keys |
current_user |
User associated with HKEY_CURRENT_USER keys |
General format:
reg_key_X = key_path|display_name