11-01-2023 12:32 PM
Trying to create 2 device groups based on similar multiple criteria. 1 works fine, the other doesn't.
Custom Flag checks for specific VLANs on a switch and turns teh flag on if present.
Group 1 uses the custom flag and existing paramaters and seems to be working just fine.
$custom_VLANSEXISTS eq 'TRUE' and $Name like /TEST1/ or $Name like /TEST2/ or $Name like /TEST3/
When I create Group 2 that exludes the names to sort out those from the list, it doesn't work and inclues multiple devices that don't match the first criteria:
$custom_VLANSEXISTS eq 'TRUE' and $Name not like /TEST1/ or $Name not like /TEST2/ or $Name not like /TEST3/
Tried various formats of the same criteria above without success.
$custom_VLANSEXISTS eq 'TRUE' and ($Name not like /TEST1/ or $Name not like /TEST2/ or $Name not like /TEST3/) - FAILED
Solved! Go to Solution.
11-04-2023 11:00 AM
First, the parenthesis that you included in your first example are required for the affirmative test -- where any of the three patterns are matched. Otherwise the boolean order of operations would first evaluate the "and", followed by the two "or" conditions.
If I understand correctly, you want to omit devices that match any of the three name patterns. For the negative match, you need to use:
$Name not like /TEST1/ and $Name not like /TEST2/ and $Name not like /TEST3/
Since those are all "and" conditions, the parenthesis are not needed.
11-06-2023 09:27 AM
Awesome, thanks that was it. Not sure why I didn't go that route. I apprecaite your help.