[gptalk] Re: WMI Question

  • From: "Jason Williams" <jasonwilliams74@xxxxxxxxx>
  • To: gptalk@xxxxxxxxxxxxx
  • Date: Wed, 18 Jul 2007 10:28:35 -0700

Wow....lots of power here...lots to learn as well. :)

Just playing around when creating a WMI, what should the NAMESPACE be? Right
now, I show: root\CIMv2

Very cool stuff. I like...just need to start learning this. :)



On 7/18/07, Nelson, Jamie R Contr 72 CS/SCBAF <
Jamie.Nelson.ctr@xxxxxxxxxxxxx> wrote:

 You can also use LIKE statements in your WMI filter. The following would
work for what you are trying to do.

SELECT * FROM Win32_OperatingSystem WHERE Caption LIKE '%Windows XP%'

For more information on WMI filters, you can check out the following
Microsoft HOWTO. It breaks down the process and has some related links you
can visit to learn more about WMI.

HOWTO: Leverage Group Policies with WMI 


Jamie Nelson

*From:* gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] *On
Behalf Of *Kees Baggerman
*Sent:* Wednesday, July 18, 2007 10: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 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 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: