[gptalk] Re: Help with WMI Filter

  • From: "Delaney, Doug" <doug.delaney@xxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Wed, 31 Jan 2007 13:06:52 -0500

Here are a few examples that may help.
 
NOTE: The word professional is spelled differently in different
languages, and therefore omitted.
 
XP Only:
1. SELECT * from Win32_OperatingSystem WHERE Caption LIKE "Microsoft
Windows XP%"   (Could also be LIKE "%Windows XP%")
 
XP SP2 only:
Select * from WIN32_OperatingSystem where ServicePackMajorVerson>=2 and 
Version='5.1.2600' 
 
2000 Only:
2. SELECT * from Win32_OperatingSystem WHERE Caption LIKE "Microsoft
Windows 2000%"   (Could also be LIKE "%Windows 2000%")
 
Hardware specific examples:
Dell only:
3. SELECT Model FROM Win32_ComputerSystem WHERE manufacturer LIKE
"Dell%"
 
Dell, XP, specific models only:
(two queries)
4. Select * from Win32_OperatingSystem WHERE Caption LIKE "Microsoft
Windows XP%"
4. Select * from Win32_ComputerSystem WHERE manufacturer LIKE "Dell%"
AND Model LIKE "%D410%" OR Model LIKE "%D420%" OR Model LIKE "%D610%" OR
Model LIKE "%M70%" OR Model LIKE "%D620%" OR Model LIKE "%M65%"
 
Server 2003 Enterprise:
SELECT * FROM Win32_OperatingSystem WHERE Caption = "Microsoft(R)
Windows(R) Server 2003, Enterprise Edition"
 
Any version of Server 2003
SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE  "%Server 2003%"
 
Server 2000
SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE "%2000 Server%"
( I don't have any left to test this on)
 
Information on Operators:
http://msdn2.microsoft.com/en-us/library/aa394605.aspx
 
 
I have the first four (numbered) running in production.  Test any
filters before any implementation.

Doug Delaney
GM Desktop Engineering
Global Client Engineering GM
1075 W. Entrance Dr., MS 2B, Cube 2130
Auburn Hills, MI 48326
Lab: 248-365-9187
Tel: 248-754-7917
Pg: 248-870-0306 pager
Mail: Doug.Delaney@xxxxxxx <mailto:Doug.Delaney@xxxxxxx>  

Note: The information in this email is intended solely for the
addressee. Access to this email by anyone else is unauthorized. If you
are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it is prohibited.

 


________________________________

        From: gptalk-bounce@xxxxxxxxxxxxx
[mailto:gptalk-bounce@xxxxxxxxxxxxx] On Behalf Of Buonora, Craig (GE,
Research, consultant)
        Sent: Wednesday, January 31, 2007 11:47 AM
        To: gptalk@xxxxxxxxxxxxx
        Subject: [gptalk] Re: Help with WMI Filter
        
        
        Just ask, if I wanted to do the same so only servers running
Windows 2000 ran or used the GPO what would that filter "script" look
like?
         
        Craig M. Buonora

________________________________

        From: gptalk-bounce@xxxxxxxxxxxxx
[mailto:gptalk-bounce@xxxxxxxxxxxxx] On Behalf Of Salandra, Justin A.
        Sent: Wednesday, January 31, 2007 11:38 AM
        To: gptalk@xxxxxxxxxxxxx
        Subject: [gptalk] Re: Help with WMI Filter
        
        

        Thanks that worked

         

        Justin A. Salandra

        MCSE Windows 2000 & 2003

        Network and Technology Services Manager

        Catholic Healthcare System

        646.505.3681 - office

        917.455.0110 - cell

        jasalandra@xxxxxxxxxxx <mailto:jasalandra@xxxxxxxxxxx> 

         

        
________________________________


        From: gptalk-bounce@xxxxxxxxxxxxx
[mailto:gptalk-bounce@xxxxxxxxxxxxx] On Behalf Of Darren Mar-Elia
        Sent: Wednesday, January 31, 2007 11:32 AM
        To: gptalk@xxxxxxxxxxxxx
        Subject: [gptalk] Re: Help with WMI Filter

         

        Justin-

        WMI filters can only be queries-they can't be full blown
scripts. So, all you need to put into your query is:

         

        SELECT * FROM Win32_OperatingSystem WHERE Caption = 'Microsoft
Windows 2000 Professional'

         

        You could also just query on buildName and say that if
buildnumber is less than 2600 (XP's build number), apply. That would
have the same effect.

         

        Select * from Win32_OperatingSystem Where BuildNumber <2600

         

         

         

        From: gptalk-bounce@xxxxxxxxxxxxx
[mailto:gptalk-bounce@xxxxxxxxxxxxx] On Behalf Of Salandra, Justin A.
        Sent: Wednesday, January 31, 2007 8:20 AM
        To: gptalk@xxxxxxxxxxxxx
        Subject: [gptalk] Help with WMI Filter

         

        I am trying to create a WMI Filter so that only computers that
match this filter will apply the policy.

         

        My thought process here is to query the OS Caption = Windows
2000 Professional, this way Windows XP and Windows 2003 computers will
not  bother to apply the policy and since Windows 2000 computers ignore
WMI Filters anyway then it would only apply to those that I want it to
apply to.

         

        When I try to create the WMI Script, when I click on save I get
an error message that says "a syntax error occurred trying to evaluate a
query string".

         

        I have pasted the script below.  I created this script using a
WMI Code Creator that I downloaded off the Web.  Can anyone help?

         

         

         

         

        strComputer = "." 

        Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2") 

        Set colItems = objWMIService.ExecQuery( _

            "SELECT * FROM Win32_OperatingSystem WHERE Caption =
'Microsoft Windows 2000 Professional'",,48) 

        For Each objItem in colItems 

            Wscript.Echo "-----------------------------------"

            Wscript.Echo "Win32_OperatingSystem instance"

            Wscript.Echo "-----------------------------------"

            Wscript.Echo "Caption: " & objItem.Caption

        Next

         

        Justin A. Salandra

        MCSE Windows 2000 & 2003

        Network and Technology Services Manager

        Catholic Healthcare System

        646.505.3681 - office

        917.455.0110 - cell

        jasalandra@xxxxxxxxxxx <mailto:jasalandra@xxxxxxxxxxx> 

         

Other related posts: