xerxes2985 Posted August 8, 2018 Report post Posted August 8, 2018 So, I have a few custom groups in my task sequence that install applications based upon some WMI queries using a naming convention. But I am having some issues trying to get it working exactly. Here is what I am trying to do. I have two groups. Employee and Labs. The naming convention for employees is LIB-AU and for the Labs its LIB-AUXXXXX-XX where the X's represent numbers I have this particular "If" statement. Here is the query in question that I currently have for employee SELECT * FROM Win32_ComputerSystem WHERE Not Name LIKE 'LIB-AU%-%' Here is the query for the labs group. SELECT * FROM Win32_ComputerSystem WHERE Name LIKE 'LIB-AU%-%' The behavior that occurs is that everything under the employees group installs to a system if it has the name "LIB-AUXXXXX-XX" - I don't want this to happen. I only want it to run the steps if it meets the 'LIB-AUXXXXX' naming, but otherwise skip it. The query for the "labs" group works fine. Any suggestions? Quote Share this post Link to post Share on other sites More sharing options...
skissinger Posted August 13, 2018 Report post Posted August 13, 2018 TEST TEST TEST I don't have a naming convention like this, but this "MIGHT" work--I suggest testing. A lot. Assumptions: There are EXACTLY 5 numbers between the LIB-AU and the - for the Lab machines and then exactly 2 numbers after the - There are EXACTLY 5 numbers for the LIB-AU ones where they don't have a - for employee machines Labs: Select * from win32_ComputerSystem Where Name like 'LIB-AU[0-9][0-9][0-9][0-9]-[0-9]-[0-9][0-9]' Employees: Select * from win32_ComputerSystem Where Name like 'LIB-AU[0-9][0-9][0-9][0-9][0-9]' Why this might work.... the [0-9]; that's a WQL/SQL query trick. So you're saying... after the LIB-AU, that next character has to be a number between 0-9 Then the next character has to be 0-9 ... up to 5 characters (for Employees) For Lab, it has to be LIB-AU, then 5 numbers, then a -, then 2 numbers. 1 Quote Share this post Link to post Share on other sites More sharing options...
RubberyDuck Posted August 27, 2018 Report post Posted August 27, 2018 Try: Select * From Win32_ComputerSystem Where Not Name = 'LIB-AU_____-__' Quote Share this post Link to post Share on other sites More sharing options...