Don't think you can use more than one WHERE... Use parenthesis.

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Miller Bonnie L.
Sent: Friday, June 2, 2017 3:05 PM
To: ntsysadm@lists.myitforum.com
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

Reply via email to