Tell me what I'm doing wrong with this query
I'm trying to set up a collecitn for software updates that targets a specific set of machines from different sites in our hierarchy. I've set up the query as follows: 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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_R_System.Client = 1 or SMS_R_System.Client is not null and SMS_G_System_OPERATING_SYSTEM.Caption like "Microsoft Windows XP%" and SMS_G_System_OPERATING_SYSTEM.CSDVersion = "Service Pack 3" and SMS_R_System.Name not like "%DS%" and SMS_R_System.Name not like "%APP%" and SMS_R_System.Name not like "AMS%" and SMS_R_System.NetbiosName not like "AMG%" and (SMS_R_System.Name like "GEM%" or SMS_R_System.Name like "BAY%" or SMS_R_System.Name like "BCH%" or SMS_R_System.Name like "MER%" or SMS_R_System.Name like "WIN%" or SMS_R_System.Name like "ENR%" or SMS_R_System.Name like "SUZ%" or SMS_R_System.Name like "BRZ%" or SMS_R_System.Name like "BDP%" or SMS_R_System.Name like "BEJ%" or SMS_R_System.Name like "GNG%" or SMS_R_System.Name like "CAN%") although it certainly brings in all themachines that start with the variable, it also pulls in machines named AM... and DS... and AMS... and ...APP... and doesnt' seem to give a damn that these are all NOT SP3 machines, so the NOT LIKE statemenet seems to be getting roundly ignored along with the other NOT LIKE statements. I'm frustrated beyond measure trying to get this stinking query to actually show me what I want it to show. So obviously I've done something terribly wrong somewhere in my logic or maybe I'm jsut asking to much of WQL. Any help will be greatly appreciated.
October 6th, 2010 11:27pm
Thanks for replying John; I actually went back and reduced the variables because for whatever reasons, it was still showing the machines that were SP2 AND servers AND the names I was trying to avoid because they were still showing up. So, I reduced it to just the statements that look for the Os, SP and the name properties listed above. That works great, and since the machines that are current'y SP3 in our environment are also SCCM clients it no longer shows the non-clients. The reason I couldn't use the "Microsoft Windows XP Professional" and had to look for XP% is that some o f the machines are 64bit which has a different caption than XP Pro. So, after much grief and sturmunddrang, I've got the query at least displaying information I expect to see.
October 7th, 2010 1:26am