[gptalk] Re: WMI Question

  • From: "Kees Baggerman" <K.Baggerman@xxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Wed, 18 Jul 2007 17:47:32 +0200



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 is.


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

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: