Custom inventory rule syntax question
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!
Thanks in advance!
PS am aware of the below, just wondering if there are yet more commands listed somewhere that might suit my needs...
GENERAL INFORMATION
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.
FUNCTION SYNTAX
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.
FUNCTION SYNTAX
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
1 Comment
[ + ] Show comment
-
Thank you for your help!! - agibbons 9 years ago
Answers (4)
Answer Summary:
Please log in to answer
Posted by:
SMal.tmcc
9 years ago
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
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
Comments:
-
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. - agibbons 9 years ago
-
see my answer for how to do that. - SMal.tmcc 9 years ago
Posted by:
chucksteel
9 years ago
I would probably use the RegistryValueReturn function and then use smart labels to identify the machines that match the criteria you need.
Comments:
-
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. - ArroyoD 8 years ago
Posted by:
SMal.tmcc
9 years ago
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.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384187%28v=vs.85%29.aspx
in your cir call reg.exe this way:
%windir%\Sysnative\reg.exe query.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384187%28v=vs.85%29.aspx
Comments:
-
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 - SMal.tmcc 9 years ago
Posted by:
StockTrader
9 years ago
Hello,
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