Jump to content


Recommended Posts

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
image.png.92a370d17ad9f0b36b8a5f4cffd28402.png

I have this particular "If" statement. 

image.png.015b981b32de20f2986a62e77e4c00e6.png

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?

Share this post


Link to post
Share on other sites


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. 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...