WMI and GPO

  • Thread starter Thread starter Emiliano G. Estevez
  • Start date Start date
E

Emiliano G. Estevez

Hi,

I like to made a WMI filter that identifies the os version and language so I
can apply a software based on that information. Anybody knows how can I
acomplish this using WMI filters.

Best Regards,
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem",,48)
For Each objItem in colItems
Wscript.Echo "Locale: " & objItem.Locale
Wscript.Echo "Version: " & objItem.Version
Next

This is from Scriptomatic... Awesome tool... easy to use... (free!
http://www.microsoft.com/technet/community/scriptcenter/tools/wmimatic.mspx)

the loop may be unecessary in this case.

HTH

Kevin
AutoProf
http://www.autoprof.com/policy
 
Actually, Kevin, Emiliano, you can't put script code into a GP-based WMI
filter, so the code below, while a good starting point, can't be used as-is.
What you would want is something like this:

Root\CimV2; Select * from Win32_OperatingSystem WHERE BuildNumber=2600 AND
Locale=0409

What this filter would do is select all machines running XP (BuildNumber
2600) and using English as their language (Locale=0409)

Hope that helps.

--
Darren Mar-Elia
MS-MVP-Windows Server--Group Policy
Check out http://www.gpoguy.com -- The Windows Group Policy Information Hub:
FAQs, Whitepapers and Utilities for all things Group Policy-related
 
sorry for the bad form... I clipped a bit too much from the script. Make
sure you reference strComputer = "." as the first line in the script. Also
the Locale property comes out as 0409. This is the language version for the
endglish language pack. These could be resolved in the code if you need to
get more detailed. I didn't find a property in the Win32_* classes that
named 0409 as English. I am sort of convinced it is in there but didn't scan
too much. Anyone know?

Kevin
 
Good point Darren. I tend to use Scriptomatic as a starting point and then
do the convesion into WQL myself.

Thanks for the clarification.

Kevin
 
Back
Top