Trouble with subnet collection query
I don't think the first query is giving you exactly what you need either is it? 10.236.207.[2-9][0-9] - will give you addresses from .20 to .99, and 10.236.207.11[0-9] - will give you addresses from .110 to .119 - so you're missing anything between .100 and .109 I think? Just use 10.236.207.10[0-9] instead. So the full query will be: 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 IPAddresses like "10.236.207.[2-9][0-9]" or IPAddresses like "10.236.207.10[0-9]" or IPAddresses like "10.236.207.120" The first statement in your second query (10.236.207.1[2-9]0) will return you .120 and .130 - but you don't want to start until .140, and your last statement will give you addresses up to .249, when you only want to finish at .240 Try: where IPAddresses like "10.236.207.1[4-9][0-9]" or IPAddresses like "10.236.207.200" or IPAddresses like "10.236.207.2[0-3][1-9]" or IPAddresses like "10.236.207.240" However, there must be an easier way to search for a range of IP addresses surely?!? I'll take a look and see if I can come up with anything.
March 18th, 2011 9:15pm

Hi, I've made a post question a while ago as to creating a query that seperates a subnet into two groups. Unfortunately after reading many posts my query works for only half of my work The two collections are as so I need to create one collection which is containing all the pcs in range 10.236.207.20-120 and another collection which contains all the pcs in range 10.236.207.140-240 The two queries I have written are as so, the first query works as far as I can tell as it populates all the pcs in the range required, but the second query does not work. does anyone have time to correct my query if there are problems within ? 1st query 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 IPAddresses like "10.236.207.[2-9][0-9]" or IPAddresses like "10.236.207.11[0-9]" or IPAddresses like "10.236.207.120" 2nd Query 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 IPAddresses like "10.236.207.1[2-9]0" or IPAddresses like "10.236.207.1[2-9][1-9]" or IPAddresses like "10.236.207.2[0-4]0" or IPAddresses like "10.236.207.2[0-4][1-9]" Please let me know Thanks in advance
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2011 11:06pm

Thank for your help, The queries now work
March 25th, 2011 4:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics