How combinating AND / OR operators in a custom inventory rule ?
Hi,
I have a custom inventory rule who is verifing a version of Adobe Reader (10.1.X...) and if the version is greater than 10.1.x the computer is "up to date". I have also other conditions in the custom rule but they are all working.
My custom rule for adobe reader:
ProductVersionGreaterThan(%SYSTEMDRIVE%\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe, 10.1)
But, a new version of adobe reader has been reloaded "Adobe Reader XI" (11.x.x...) a few days ago, and my custom rule is not working now because the path of Adobe Reader has changed:
%SYSTEMDRIVE%\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe
I try to make a rule like this to include the new version:
(ProductVersionGreaterThan(%SYSTEMDRIVE%\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe, 10.1) OR
ProductVersionGreaterThan(%SYSTEMDRIVE%\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe, 10.99)) AND (...) AND(...) AND...).
But it's not working..
I try to make a rule with using Registry keys, but it's the same problem with the name of Adobe Reader path's folders.
Question:
How can I do for combinatting AND / OR operators in a custom inventory rule ?
Thanks for your advices !
Greetings
KACE Agent version: K1000 - Version 5.3.53053 (Last version available)
OS: Windows 7 SP1 and Windows XP SP3
Answers (3)
My suggestion would be to use a Smart label to handle this, as you can chain qualifiers and get as specific or general as necessary. You may have to adjust how you handle some processes (i.e. reports, etc), but I've found Smart labels to handle this specific situation very well.
If you need some background on Smart labels, here's an article I wrote:
http://www.itninja.com/blog/view/k1000-labels-effective-organization-process-flow-using-manual-smart-ldap-labels-and-label-groups
And if you need any help with createing/adjusting the REGEX statements for specifying software versions (= or <), this is another article I wrote:
http://www.itninja.com/blog/view/using-regex-in-smart-labels-to-find-lower-versioned-software-w-java-example
To help with your specific situation, this Smart label query would tag all machines running either Adobe Reader 10.1.4 or Adobe Reader 11.0 - you could name the smart label "ar-current" for example:
select *, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,UNIX_TIMESTAMP(MACHINE.LAST_SYNC) as LAST_SYNC_SECONDS
from ORG1.MACHINE
LEFT JOIN KBSYS.KUID_ORGANIZATION ON KUID_ORGANIZATION.KUID=MACHINE.KUID
LEFT JOIN KBSYS.SMMP_CONNECTION ON SMMP_CONNECTION.KUID = MACHINE.KUID AND KUID_ORGANIZATION.ORGANIZATION_ID = 1
where (( (1 in (select 1 from ORG1.SOFTWARE, ORG1.MACHINE_SOFTWARE_JT where MACHINE.ID = MACHINE_SOFTWARE_JT.MACHINE_ID
and MACHINE_SOFTWARE_JT.SOFTWARE_ID = SOFTWARE.ID
and SOFTWARE.DISPLAY_NAME like 'Adobe Reader%'
and (SOFTWARE.DISPLAY_VERSION RLIKE '(^11[[.period.]]0[[.period.]]00$)'
OR SOFTWARE.DISPLAY_VERSION RLIKE '(^10[[.period.]]1[[.period.]]4$)'))) ))
Hope that helps!
John
As far as I know, the use of both operators is not supported, but it's theoretically possible. My guess would be something like this if it is indeed possible:
rule1 AND rule2 AND rule3 OR rule4 AND rule5 OR rule6
As an alternative, you could use something like this (Reader XI on Win7x64 in this example) for each version and use OR to put them together:
RegistryKeyExists(HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-AB0000000001}, DisplayVersion, 11.0.00)
Comments:
-
Ok i will try to test your suggest "rule1 AND rule2 AND rule3 OR rule4..."
and i found another post about the combination of AND/OR operators. it's talking about the order of the reading method of the custom inventory rule:
http://www.itninja.com/question/custom-inventory-rule-questions
Perhaps can it be helpfull? - CIAD 12 years ago
Hello back,
After some tests, it's look impossible to combinate the 2 operators in a same custom rule. The parentheses are not working to separate operator's effects.
It will be always confront the 2 parts of the "OR" (1st side OR 2nd side ) operator and will not take in case the end of the rule syntax ( other functions after the "OR" operator).
Here an example:
FUNC(...) AND FUNC(...) AND FUNC(...) OR FUNC(...) AND FUNC(...)
equals to
A AND A AND A OR B AND A AND ...
But the functions after the "OR" operator are not considered, So we can write like that:
A AND A AND A OR B AND A AND ...
= A AND A AND A OR B
So if one of the function in the "A" part is not matching, it will automatically switch on the function after the "OR" operator (here part B)..
It seems like an IF /ELSE programming operation.
Thanks for help !
Greetings