Session relevance - members of group X but not group Y

I swear this code used to work, but today I am getting strange results. ServerA exists in two automatic computer groups - 51 and 47866. I use session relevance to return all computers that haven’t checked in over 12 hours from group 51, but I ignore computers who are also part of group 47866. But ServerA is returning as relevant today even though it is a part of both groups.

(names of elements whose (now - last report time of it > 12 * hour) of it) of (member sets of bes computer groups whose (id of it is contained by set of (51) and id of it is not contained by set of (47866)))

This whose() clause on this query is filtering out computer groups, not computer group members.

bes computer groups whose (id of it is contained by set of (51) and id of it is not contained by set of (47866))

This portion of the query is listing all computer groups. First it filters to the set of groups with an ID contained by the set of 51 (there is only one member in this set, the group with an ID of 51). Then we also filter out any computer groups with an ID of 47866 (that group is already not in the set so this AND clause has no effect).

I think what you’re intending is to find the computers with a computer id listed in the member set of the first group but not in the member set of the second group. That can be done, but it’s a little convoluted and there’s an easier approach using set subtraction. Try

names of elements whose (now - last report time of it > 12 * hour) of (member set of  bes computer groups whose (id of it = 51) - member set of bes computer groups whose (id of it = 47866))
3 Likes