Smart Label for machines in ip range and exclusions
I have a query where I want to add a smart label for all machines in a given ip range, but exclude those that start with TC.
It works successfully on the IP range but it still includes those with names that start with TC
here is an excerpt from my query:
OR (1 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP like '%172.16.12.%' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP like '%172.16.12.%' and MACHINE.NAME not like '%TC%' )) )
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
chucksteel
6 years ago
Posted by:
DaveMT
6 years ago
Try this for your SQL Code.
SELECT MACHINE.NAME AS SYSTEM_NAME,SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROMMACHINE WHERE ((MACHINE.IP like '172.16.12.%') AND ((MACHINE.NAME notlike 'TC%')))
You could also open yourInventory>Devices section, choose the Smart Label tab to create a smartlabel from manual Advanced searches. Choose your first line to filteryour IP to IP Address Begins with 172.16.12. then click Add Group and in that newgroup, choose a filter for System Name Does NOT begin with TC. Save thatlabel and it should work as well.