Relevance issue with excluding computer names

I have the following relevance for a particular type of machine. I recently noticed two servers whose IP address ends in .174 and .173 that is being included with this relevance. I want to exclude those two machines either by name or by IP. I tried to do with and ended up including anything that didn’t include those IPs. I feel like this is probably a pretty easy problem to solve but I can’t seem to wrap my brain around it. How would I include an exclusion for computers named “computer1” and “computer2” without blowing this entire thing up? Thanks

(exists adapters whose (address of it as string = “10.10.12.171” or address of it as string = “10.10.12.172” or address of it as string ends with “.39” or address of it as string ends with “.174” or address of it as string ends with “.173”) of network)

You could add an expression to exclude when computer name is not X or Y

(computer name as lowercase is not contained by set of ("computer1";"computer2"))

Another idea for the IP checking, a) you could do a string compare against a string set of address instead of address of it as string = “10.10.12.171” or address of it as string = “10.10.12.172” and if you cast the address to a string then a version you can then use the build revision inspector to compare the last octet of the IP addresses. So all in all

exists addresses whose ((it as string is contained by set of ("10.10.12.171";"10.10.12.172")) or (build revision of (it as string as version) as string is contained by set of ("39";"173";"174"))) of adapters of network and (computer name as lowercase is not contained by set of ("computer1";"computer2"))

You could also add an AND to exclude by IP address in this type of approach too.

exists addresses whose (((it as string is contained by set of ("10.10.12.171";"10.10.12.172")) or (build revision of (it as string as version) as string is contained by set of ("39";"173";"174"))) and (it as string is not contained by set of ("192.168.0.173";"192.168.0.174"))) of adapters of network

There are probably other approaches too. I find using string sets as a nice way to reduce to number of OR comparisons.

3 Likes

Thank you for all the suggestions. I will try them out and let you know!

Unfortunately this did not work. Does anyone else have a suggestion on how to exclude 2 computer names or 2 IP addresses from the statement?

You can also try below & expand as desired -
not exists (computer name) whose (it as string as lowercase contains "UrHostname" as lowercase)

OR

("|Urhostname1|Urhostname2|" as lowercase contains "|" & computer name as lowercase as string & "|" ) is not true

2 Likes

It sounds like you are looking for something like this where computer1 & computer2 are the computers you want to avoid.

Depending on how you are using the Editor, you can either include the two phrases as part of the Relevance clauses and let the Console AND them together when you save the Fixlet, or you can put them together in the same phrase like I have listed above.

1 Like

Did you try just adding a NOT in front to reverse the polarity?

q: (exists adapters whose (address of it as string = "10.10.12.171" or address of it as string = "10.10.12.172" or address of it as string ends with ".39" or address of it as string ends with ".174" or address of it as string ends with ".173") of network)
A: False

q: not exists adapters whose (address of it as string = "10.10.12.171" or address of it as string = "10.10.12.172" or address of it as string ends with ".39" or address of it as string ends with ".174" or address of it as string ends with ".173") of network
A: True

This is what I am trying to do. I will try this and let you know if it works. Thanks!

1 Like

This worked perfectly. Thank you so much!