I tried looking for some info on how WMI plans and optimizes queries suspecting it was something like how SQL engines did but at least a quick search failed to find any info.
Regardless, I would write the queries like this: select * from Win32_OperatingSystem where ProductType="1" AND Version like "10.0%" AND Version != "10.0.10586" select * from Win32_OperatingSystem where ProductType="1" AND Version like "10.0%" select * from Win32_OperatingSystem where Version != "10.0.10586" Also, do you need all the fields returned? I didn't bench these but if they do behave like I would loosely imagine, ordering the constraints would reduce the result sets pushed into each consecutive predicate. hth, jlc From: [email protected] [mailto:[email protected]] On Behalf Of Miller Bonnie L. Sent: Friday, June 2, 2017 3:05 PM To: [email protected] Subject: [NTSysADM] WMI query for AD Trying to craft a wmi filter for differences in update policies and preferences in AD. I want it to select all versions of Win10 EXCEPT for 1511. I have queries that work for 1511, 1607, and 1703, as well as all of Win10 and earlier OSes. So, I'm trying to put those together and am having trouble when saving, it says I have a syntax error. Is it not possible to query the same value twice at once? select * from Win32_OperatingSystem where (Version like "10.0%") AND (ProductType="1") AND where NOT (Version = "10.0.10586") Or, is there some other syntax error I'm not catching, such as with the way I have the NOT statement. I don't want it to run on our Win7 or 8.1 machines, and was hoping not to have to add each new version of Win10 going forward by doing this as an exclude. I also noticed that the editor allows for multiple queries in one filter, so I'm not sure if they should rather be stacked like this: select * from Win32_OperatingSystem where (Version like "10.0%") AND (ProductType="1") and then a second one for select * from Win32_OperatingSystem where NOT (Version = "10.0.10586") Another option may be using GPP targeting if this doesn't work since most of what I want can be accomplished via registry changes. I'm heading out but will pick this back up on Monday, so any suggestions are appreciated. Thanks, Bonnie

