[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 #.

 

Darren

 

 

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

 

JW,

 

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
Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
wscript.echo objOperatingSystem.Caption
Next

 

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

 

Namespace: 
root\CIMv2

Query:
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
Enterprise.

 

 

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.


JW

Other related posts: