• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 881
  • Last Modified:

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 Ren
Kylo Ren
  • 2
1 Solution
Chris DentPowerShell 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,%'


Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now