[gptalk] Re: WMI Question

  • From: "Darren Mar-Elia" <darren@xxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Wed, 18 Jul 2007 08:56:17 -0700

You can also do something like this:


SELECT * FROM Win32_OperatingSystem WHERE BuildNumber != "6000"


Where you look for build numbers that are not Vista's #.





From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Kees Baggerman
Sent: Wednesday, July 18, 2007 8:48 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Re: WMI Question




You could use the following VBS Script to get the name of the OS


strComputer = "."
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim WshShell
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from
For Each objOperatingSystem in colOperatingSystems
wscript.echo objOperatingSystem.Caption


If you take the output of the script you can create a WMI Filter in the



Select * from Win32_OperatingSystem where Caption = "Microsoft(R) Windows(R)
Server 2003, Enterprise Edition"


Where Microsoft(R) Windows(R) Server 2003, Enterprise Edition the OS name


With this example you only process the GPO if the OS is Windows 2003



Kind regards,


Kees Baggerman


From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Jason Williams
Sent: Wednesday, July 18, 2007 5:43 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] WMI Question


I am jumping into some situations where I am going to need to get started
with WMI scripting. For example, we have a GPO that sets XP Firewall
policies and it looks like it is causing problems with our Vista machines
and their firewalls. 


I thought this would be a good time to get started with WMI and make this
policy only apply to XP machines. However, I am not sure where to begin.

Not sure if this is the place or not, but was wondering if someone can point
me to some links on how to get started with scripting for WMI?


Appreciate it.


Other related posts: