Can I create a smart label that checks on user login based on a label of user names
Can I create a device smart label that would check for computer devices based on User Name for the computer which is defined in a user label? Right now, to achieve this, I am setting my device smart label to do a REGEX search against a static set of usernames which I use the ^(user1|user2|....)$ expression to define.
Is it possible to have it look against a label of user names instead. Or if not, can we plan on having this as a new feature?
Answers (2)
Yes, this should be possible. Are you sure you want to use logged in user? I ask because this may change, particularly if the computer updates inventory when at the login window.
Comments:
-
Hi, yes, I am currently using User Name, but for people's personal computers which I am mainly targeting the logged on user should be the same as what Kace thinks or knows as the owner of the computer.
How would I have the define the Advanced Search to enable the device search against a label of user names? - tuyen 4 years ago -
As Chuck pointed out, User smart labels are evaluated at login. Device smart labels are evaluated at the inventory check-in interval.
If you have a smart label that depends on another smart label you will want to set the order in which they are evaluated.
To set order in which to run the Smart Labels:
On the left navigation bar, in the Home section, click Label Management.
On the Label Management panel, click Smart Labels.
Select Choose Action > Order Labels > Device Smart Labels. - KevinG 4 years ago-
I have a static label of user names which I defined in Settings -> Users
In Devices, I want to define a smart label that would look at User Name and search based on list of users in the static label of users. Is that possible?
Right now I am having it do a REGEX filter against a static search expression that I define. Can I have it check against a label of users? And how would I be able to do that? - tuyen 4 years ago
- In Inventory create a new smart label
Open the smart label tab and enter a label name and click Save. We will be changing the SQL so there's no need to set any criteria - Open the newly created smart label
Home, Label Management, Smart Labels, click on the label - Click the Edit SQL button
- Delete everything in the SQL text box
- Paste in the query below
Be sure to put your label name where it says "your label name" - Save the label
SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE
LEFT JOIN USER on USER.USER_NAME = MACHINE.USER
LEFT JOIN USER_LABEL_JT on USER_LABEL_JT.USER_ID = USER.ID
LEFT JOIN LABEL on LABEL.ID = USER_LABEL_JT.LABEL_ID
WHERE LABEL.NAME = "your label name"
Again, if the inventory updates on a machine when there isn't a logged in user, the label will not be applied. If you are assigning owner to machines, then I would use that criteria instead. In that case, the following query should be used:
SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE
JOIN ASSET on ASSET.MAPPED_ID = MACHINE.ID
JOIN USER OWNER on OWNER.ID = ASSET.OWNER_ID
LEFT JOIN USER_LABEL_JT on USER_LABEL_JT.USER_ID = OWNER.ID
LEFT JOIN LABEL on LABEL.ID = USER_LABEL_JT.LABEL_ID
WHERE LABEL.NAME = "your label here"