Systems Management Question

Custom inventory rule syntax question

12/04/2014 5106 views
Is it possible in K1000 --> Inventory --> Software --> New Item --> Custom Inventory Rule to specify RegistryValueContains(path, *specific string*) or something like it)? The registry key I'm querying will always have 3 characters in common, but other characters will vary.

In other words I want my custom inventory rule to imply: 

"Return to me how many/which PCs have RegistryValueContains(fullpath,somecharacters*123*somecharacters) and RegistryValueContains(fullpath,somecharacters*ABC*somecharacters), because the values 123 and ABC are meaningful to me." 

Can I work a wildcard into this syntax?

Thanks in advance! 

PS am aware of the below, just wondering if there are yet more commands listed somewhere that might suit my needs...

The use of the Custom Inventory Rules is very powerful and you should read the documentation before attempting to configure one of these rules. There are a variety of concerns that should be reviewed before enabling this. The notes here are meant only as a quick syntax reference for the available functions.

Windows (* = 5.2+)
|  Linux
|  | Mac OS 
|  | |   
W  L M - DirectoryExists(path)
W  L M - FileExists(path)
W* L M - FileExistsWithMD5(path, value)

W      - FileVersionEquals(path, version)
W      - FileVersionLessThan(path, version) 
W      - FileVersionGreaterThan(path, version) 

W      - ProductVersionEquals(path, version) 
W      - ProductVersionLessThan(path, version) 
W      - ProductVersionGreaterThan(path, version) 

W  L M - FileInfoGreaterThan(fullpath, attribute, type, value)
W  L M - FileInfoLessThan(fullpath, attribute, type, value)
W  L M - FileInfoEquals(fullpath, attribute, type, value)

W      - RegistryKeyExists(registryPath) 
W      - RegistryValueEquals(registryPath, valueName, value) 
W      - RegistryValueLessThan(registryPath, valueName, value) 
W      - RegistryValueGreaterThan(registryPath, valueName, value) 
etc etc etc
Answer Summary:
1 Comment   [ + ] Show comment


  • Thank you for your help!!

Community Chosen Answer

use a reg query CIR to get this info

ShellCommandTextReturn(cmd /c reg query and add the proper switches to get the results you want)

test this as a batch file to get the switches you need to return the results you want

Answered 12/08/2014 by: SMal.tmcc
Red Belt

  • Thank you SMal.tmcc, this worked perfectly! Now I'm trying to write another version for our 64 bit machines when the registry value I want is somewhere other than Wow6432Node... http://www.itninja.com/question/how-to-write-a-cir-that-uses-reg-query-outside-of-wow6432node-on-64-bit-windows-7-machine Slowly I'm learning! Thanks again for your help.
    • see my answer for how to do that.

All Answers

I would probably use the RegistryValueReturn function and then use smart labels to identify the machines that match the criteria you need. 
Answered 12/05/2014 by: chucksteel
Red Belt

  • I know this is an old thread, but Thank You chucksteel for your suggestion. It worked perfectly for me without having to utilize any external commands.
The problem is the kace agent is 32 bit so it makes 32 calls. to get around this use the sysnative path and it will call reg.exe from the system32 (the systems native command directory) not from the agents native directory of syswow64
in your cir call reg.exe this way:

%windir%\Sysnative\reg.exe query.

Answered 12/12/2014 by: SMal.tmcc
Red Belt

  • also call cmd.exe this way or it will run in 32bit mode. ShellCommandTextReturn(c:\windows\system32\cmd.exe /c %windir%\Sysnative\reg query blah blah blah

it is currently not possible to use wildcards or regular expression to match a registry value.
One idea could be to write a short script in VBScript that reads the registry, do the search for you (VBScript has a lot of string manipulation functions) and re-write what you really need in a registry key.
Then you can use one of the Custom Inventory Rules to pick up that value or compare it.
Another idea, always script based, could be to to dump the registry value to a file name (even 0 byte length) and the use one of the following  Custom Inventory Rules that is able to play with the regular expressions:
W  L M - FilenamesMatchingRegexExist(fullpath,regex)
W  L M - FilenamesMatchingRegexGreaterThan(fullpath,regex,value)
W  L M - FilenamesMatchingRegexLessThan(fullpath,regex,value)
W  L M - FilenamesMatchingRegexEqual(fullpath,regex,value)
W*  L M - FilenamesMatchingRegexReturn(fullpath,regex,type)

Kind regards,
Marco - StockTrader
Answered 12/05/2014 by: StockTrader
Red Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ