K1000 - Custom Inventory Rule - Not Working Due To Comma In Registry Path
Wanting to pull IPC MAC Addresses from our devices via custom inventory rule. Having issues due to the registry path.
Syntax:
RegistryValueReturn(registryPath, name, type)
CIR entry: RegistryValueReturn(HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Cisco Systems, Inc.\Communicator,HostName,REG_SZ)
Notice the comma in the "Cisco Systems, Inc." path name. Due to this, it's not returning desired results. Tried encompassing the path in parenthesis or ( ) and neither worked. For the heck of it, I removed the comma from the name with it obviously not working. Is there a wildcard or something else?
Answers (2)
RegistryValueReturn(HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Cisco Systems{{comma}} Inc.\Communicator,HostName,TEXT)
Top Answer
According to the admin guide under Syntax for Custom Inventory rules:
https://support.quest.com/technical-documents/kace-systems-management-appliance/10.1%20common%20documents/administrator-guide/143#TOPIC-1322466
Commas and parentheses as values in a rule
For example, if the user want to test against the registry value in which the value name is "test,value", the user would need to escape the comma in this case because registry value name is not the last argument in the Custom Inventory (CI) function.
Comments:
-
In this case the comma is in the registry path and did not work in my testing, Were you able to get it to work when not used in a value? - KevinG 4 years ago
-
I didn't test in my environment. I wonder if it makes a difference if you use HKLM64 instead of the WOW6432 path. - chucksteel 4 years ago
-
This worked, thank you!
RegistryValueReturn(HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Cisco Systems{{comma}} Inc.\Communicator,HostName,TEXT) - KaceBuddy 4 years ago-
Great. Please mark the question as answered and supply a summary. - chucksteel 4 years ago
I was able to reproduce this issue.
A possible workaround would be to create a script to write the value of HostName to a text file and read it in using ShellCommandTextReturn( command).
Example: ShellCommandTextReturn(cmd /c type c:\WINDOWS\TEMP\HelloWorld.txt)
On a side note, REG_SZ in your example above should be TEXT.
Type can be TEXT, NUMBER, or DATE