[gptalk] Re: WMI Filter to exclude Servers

  • From: "Omar Droubi" <omar@xxxxxxxxxxxxxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Thu, 26 Oct 2006 09:51:48 -0700

Thanks Thorbjörn ,
The filter "" SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE
"%[^Server]%" "" did not work in my tests but with your help I was able to
get my filter created. I also found that the GPMC help file has pretty good
real world examples.
The problem I found is that Windows 2000 does not read the WMI filtering- at
least it said so in the help file but I was not able to find a W2k machine
on the network- even though Active Directory shows that we have many
Anyway we are pushing out the the Block IE7 GPO to the workstations since
the company has a few web based apps that are not certified to work in IE7


From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Thorbjörn Sjövold
Sent: Wednesday, October 25, 2006 1:08 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: WMI Filter to exclude Servers

The way WMI filters works are pretty simple, although troubleshooting them
are not ;) If the result of the WQL query returns 1 or more objects then
this is interpreted as true, i.e. the GPO will be applied, if no objects are
returned it means false and the GPO will not be applied.
If you want to hit everything but Windows 2003 Server (including R2 servers)
use the following locale independent query:
SELECT * FROM Win32_OperatingSystem WHERE BuildNumber != "3790"
If you still want to use wildcards in your WQL you need to use the LIKE
operator and the wildcard character %. Since you want the go all the way on
this bumpy WQL ride and exclude and not include the servers you need to use
the NOT operator ^, see below for an example. If you want to make it even
more hardcore you can use OR/AND in the where clause.
The following would hit everything but servers:
SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE "%[^Server]%"
I know that Darren have a tool on gpoguy.com that can you can use to test
WQL queries, I have not tested myself but my guess since it comes from
Darren that is works great. Otherwise you are stuck with the built-in
WBEMTEST, a tool that isn't really a tribute to the MS GUI team :)
Hope it helps.
Thorbjörn Sjövold 
Special Operations Software 
thorbjorn.sjovold a t specopssoft.com 

Download our free tool for remote Gpupdate with graphical reporting, 



From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Omar Droubi
Sent: Wednesday, October 25, 2006 12:49 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] WMI Filter to exclude Servers

Hello all,
I have a question:
My current client does not have a great OU structure and we need to
implement a GPO that updates settings on workstations only.
I haven't used WMI filters too much so I have 2 questions:
1. does the results of the WMI filter exclude those objects or does it
include the objects?
2. Can someone help me with the syntax? I was starting with something like "
Select * FROM Win32_OperatingSystem WHERE caption <> "Windows Server 2003"
My issue is how do I write the select statement to include all of my OS
names and how can I tell it to use a wild card like "Windows Server*"

Other related posts: