[gptalk] Re: Help with WMI Filter

  • From: "Darren Mar-Elia" <darren@xxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Wed, 31 Jan 2007 08:31:30 -0800


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


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


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



Justin A. Salandra

MCSE Windows 2000 & 2003

Network and Technology Services Manager

Catholic Healthcare System

646.505.3681 - office

917.455.0110 - cell

 <mailto:jasalandra@xxxxxxxxxxx> jasalandra@xxxxxxxxxxx


Other related posts: