KACE 1000 smart machine lables based on logged in user label
Is there a way to create a smart machine label populated by the logged in user's label assignment? I am unable to deploy a script based on a user labels.
Answers (2)
Try this for your Smart label query - I tested with some user labels and it worked fine here (i.e. the machine Smart label was applied to the corresponding machines). In the next to the last line, include whatever labels you want to target (and create a corresponding Smart label to accompany it).
So, for example, if I wanted to target a user label named "managers" (and create a corresponding Smart label named "managers"), I would use this:
WHERE LABEL.NAME rlike 'managers'
If I wanted to create another that targeted multiple user groups (hr and payroll, for example), I would use this for that line:
WHERE LABEL.NAME rlike 'hr|payroll'
Here's the Smart label query itself, which you can run as a report (or MySQL Query Browser) to give you an idea of which machines it will target (and corresponding users and user labels):
SELECT MACHINE.NAME, MACHINE.USER, LABEL.NAME
FROM MACHINE
JOIN USER ON (USER.USER_NAME = MACHINE.USER)
JOIN USER_LABEL_JT ON (USER_LABEL_JT.USER_ID = USER.ID)
JOIN LABEL ON (LABEL.ID = USER_LABEL_JT.LABEL_ID)
WHERE LABEL.NAME rlike 'user label 1|user label 2|etc'
ORDER BY LABEL.NAME, MACHINE.NAME
If you need help with Smart labels, I wrote an article with a few tips/tricks:
http://www.itninja.com/blog/view/k1000-labels-effective-organization-process-flow-using-manual-smart-ldap-labels-and-label-groups
Hope that helps!
John
Depending on the goal of your script this may be useful. I don't know of any way to populate user info to a smart label and because of how they are applied that user could already be logged off by the time the script is ran so it wouldn't be efficient.
http://www.kace.com/support/resources/kb/article/How-To-Obtain-Current-User-Information