SCCM collection to use wildcard in String matching

Creating collection to get computers that starts and end with particular string is used mostly using % .If this percentile used at the end of the variable name, you get all computer names that starts from particular string and if you use this in the beginning, gets all computers that ends with particular string.

Examples : To get all computer names that starts with ESKONR, use ESKONR% , to get all computer name that ends with ESKONR ,use %ESKONR.

But what if  need all computer name that has letters like ESK in the middle of the computer name. Let says i have computers with 15 digits and they have ES placed in 10-11 . Example : INHYD1202ES0003

We can use underscore as wildcard for one character space and use them along with Like statement and apply to fields.

Collection :

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,
SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.Name like "__________ES___" and SMS_R_System.ResourceDomainORWorkgroup = "ESKONR"

We have used 9 underscores in our query before E and 4 Underscores after S to tell that first 9 digits can be any thing and last 4 digits can be anything .

Underscores (_) as wildcard can be used at any location in the query but one can replace one character only.

Hope it helps!

8 Responses to "SCCM collection to use wildcard in String matching"

  1. Hi Eswar,

    I am looking to create a dynamic collection that list members of other collections which has the name with 'ABC%'

    Could you help me with a WQL query to create a collection with the query rule that gives all computers of the collections for which the collection name starts with 'ABC%'.

    Thanks in advance.

    Reply
    1. you mean to say ,get list of all PC names from other collections that starts with ABC% ? if am not wrong,ABC% is collection name or PC name to pull the names from ? can you be more specific about the requirement ?

      Reply

Leave a Reply