WMI Queries

Hi Guys

I need to creare 4 simple wmi quries.

1 for windows 2003
1 for windows 2003 r2
1 for windows 2008
1 for windows 2008 r2

What is a simple wmi query that i can use to determine the os?

so the logic for the 1st wmi query should be to check the os and then have it match windows 2003 (or whatever the official output is)

Hopefully this makes sense.  Please advise
Kylo RenSystem EngineerAsked:
Who is Participating?
Chris DentConnect With a Mentor PowerShell DeveloperCommented:
Did you really need PowerShell? Kind of wonky zones up there.

This returns the Operating System from WMI:

Get-WmiObject Win32_OperatingSystem | Select-Object Caption

Or you can test it with:

Caption='Microsoft(R) Windows(R) Server 2003, Standard Edition'

Rather too exact, so you might prefer:

Caption LIKE '%Server 2003,%'

Where % is equivalent to the traditional * wildcard in the WQL query language.

Kylo RenSystem EngineerAuthor Commented:
no need for powershell.

I need a wmi query for filtering GPO's so they only get applied to specific servers.

Chris DentPowerShell DeveloperCommented:
Then perhaps the example above?

Caption LIKE '%Server 2003,%'

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.