/build/static/layout/Breadcrumb_cap_w.png

Smart Labels Not Seeing Other Smart Labels

We using KACE scripting to power off PCs to save power (and other reasons).

However, we don't want to power off computers such as servers, virtual machines, or those that need them powered on for remote access (via GoToMyPC or VPN), or others that must stay on. I created a smart label that automatically includes any computers in any of the above smart (or static) labels:

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.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 = 'GoToMyPC')
)
) OR (
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 = 'Servers')
)
) OR (
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 = 'Virtual Machines')
)
) OR (
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 = 'Shutdown - Reboot Only')
)
) OR (
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 = 'Shutdown - Exclude from Shutdowns')
)
)
)

The above smart label works correctly. I then have another label, "Shutdown Valencia", that collects the computers we can shutdown:

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.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 = 'Valencia')
)
)
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 = 'Shutdown - Smart Exclude')
)
)
)

The above label (which I apply to the shutdown script itself) INCLUDES an entire smart label "Valencia" EXCEPT those that are in smart label "Shutdown - Smart Exclude".

Yet after check-in, I somehow have computers added to the shutdown label when the PC is also listed in the "Shutdown - Smart Exclude" label.

If I take the above statements and run a query directly against the database or I enter my labels as an "Advanced Search", I get the EXPECTED results. It is only when I use a Smart Label the issue occurs.

 

Anyone have any idea?


0 Comments   [ + ] Show comments

Answers (1)

Posted by: darkhawktman 11 years ago
Green Belt
4

To fix this you need to order your machine smart labels. Go into Label > Smart Labels, click choose action and select Order Machine Smart Labels from the list and from here order your Smart labels in the order they need to apply to your computer. 


Comments:
  • Thanks. This appears to have done the trick. - afincher 11 years ago
    • Make sure you mark the question as answered. You get more points that way. - jknox 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ