[gptalk] Re: GPO WMI/WQL Filter

  • From: "Nelson, Jamie" <Jamie.Nelson@xxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Thu, 23 Oct 2008 17:04:03 -0500

The way you are filtering on the name though, you’re only saying the last 
character cannot be L or T. This is different than saying the last 2 characters 
can’t be LT.


Try this and see if it helps:


Select * From Win32_ComputerSystem Where Name Like "%[^Ll][^Tt]”


Jamie Nelson | Operations Consultant | BI&T Infrastructure-Intel | Devon Energy 
Corporation | Work: 405.552.8054 | Mobile: 405.200.8088 | http://www.dvn.com 


From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On 
Behalf Of Jerry Abouelnasr
Sent: Thursday, October 23, 2008 4:56 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] GPO WMI/WQL Filter


Hi everyone

I'm trying to filter a GPO using a WMI query. My goal is to have one policy 
only apply to desktops and one only apply to laptops. I understand that there 
is currently no really good method of doing this by querying hardware (and that 
a contest exists) :-). Fortunately, our naming standard appears to accomodate. 
All laptops end with "LT."

So, when I run a query for Select * From Win32_ComputerSystem Where Name Like 
"%LT"    ----  I get the desired result when I log in to a laptop with a name 
ending in LT. The policy applies. When I log into a computer that does not end 
with LT, the GPO is filtered out and denied. 

Now - to do the opposite, I'm having problems. I want to filter based on 
computers NOT named "%LT" - My goal in doing so is to have a policy ONLY apply 
to workstations (which do not end with LT in their name) --- So, I have tried: 
Select * From Win32_ComputerSystem Where Name Like "%[^LT]" ---- This works for 
me on Vista, but not on Windows XP SP2 workstations. When testing from a 
command prompt - on a workstation not ending with LT - I am able to validate 
that the "%[^LT]" exclusion is not working on XP workstations vs. it working on 
a Vista workstation using  the following command: wmic path 
win32_ComputerSystem WHERE (Name like "%[^LT]") get Name. 

So, it feels like I'm in the right neighborhood. I suspect that the Syntax 
might need to be different on XP, but I've already tried variations to no avail.

Any help would be greatly appreciated. 



Confidentiality Warning: This message and any attachments are intended only for 
the use of the intended recipient(s), are confidential, and may be privileged. 
If you are not the intended recipient, you are hereby notified that any review, 
retransmission, conversion to hard copy, copying, circulation or other use of 
all or any portion of this message and any attachments is strictly prohibited. 
If you are not the intended recipient, please notify the sender immediately by 
return e-mail, and delete this message and any attachments from your system. 

Other related posts: