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.
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!
Pingback: Wildcard character in a SCCM task sequence like clause - Boot Panic
What if I need a collection that contain the users that have an underscore in it's name?
you should try with something %_% ? it depends on the requirement and user naming how it is
Thanks Eswar for a great post. Very easy steps for a query.
Welcome Brain, Glad to help.
Eswar, I need to get all SGKFE machines....should be SGKFE%, right ?
yes, thats true. Give a try.
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.
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 ?