WMI Queries

Posted on 2011-05-11
Last Modified: 2013-11-08
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
Question by:Aaron Goodman
    LVL 70

    Accepted Solution

    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.

    LVL 4

    Author Comment

    by:Aaron Goodman
    no need for powershell.

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

    LVL 70

    Expert Comment

    by:Chris Dent
    Then perhaps the example above?

    Caption LIKE '%Server 2003,%'


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
    Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
    This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now