How to exclude machines from a smart label when they exist in another specified manual label?
I have machines named by building location. Some machines are not to get Java updates so I created a nojava label as an offshoot for each building. I deploy regular patches to the regular label and I deploy nojava patch listings to the nojava machines. The problem is some machines are showing up in both the regular label and the nojava label.
I have a manual label named "M_TESTIE" that contains 55 nojava computers I added to it. Many of those computers could have names that contain "XYZ-R" or "ABC-R". I want those 55 machines excluded from another label that their name criteria would put them in.
If a machine name contains "XYZ-R" or "ABC-R", but is in the "M_TESTIE" label, then I don't want it to be in the nojava smart label that the script below builds.
Is the code below correct in order to exclude machines that are in the M_TESTIE label?
M_XYZ\ABC-R smart label script is below. This is the label that should exclude machines that are in the M_TESTIE label. But in my case, the machines are still showing up in the label the script below creates.:
select MACHINE.*, C.CLIENT_CONNECTED, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,
UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_SECONDS
from ORG1.MACHINE
LEFT JOIN KBSYS.KUID_ORGANIZATION O ON O.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION C ON C.KUID = MACHINE.KUID AND O.ORGANIZATION_ID = 1
where (((( MACHINE.NAME like '%XYZ-R%') OR MACHINE.NAME like '%ABC-R%') AND (1 not in (select 1 from ORG1.LABEL, ORG1.MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID and MACHINE_LABEL_JT.LABEL_ID = LABEL.ID and LABEL.TYPE != 'hidden' and LABEL.NAME like '%M_TESTIE%')) ))
Answers (0)
Be the first to answer this question
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 not in (select 1 from ORG1.LABEL, ORG1.MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID and MACHINE_LABEL_JT.LABEL_ID = LABEL.ID and LABEL.TYPE != 'hidden' and LABEL.NAME like '%No Patching%')) ) AND (1 in (select 1 from ORG1.LABEL, ORG1.MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID and MACHINE_LABEL_JT.LABEL_ID = LABEL.ID and LABEL.TYPE != 'hidden' and LABEL.NAME like '%Admissions/FinAid%')) )) - chucksteel 11 years ago
The problem is machines that are in the M_TESTIE label are showing up in both the regular and nojava labels. - murbot 11 years ago