Announcement

Collapse
No announcement yet.

AD GPO WMI Queries

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • AD GPO WMI Queries

    Hi everyone,

    I am setting up new WMI queries for our company's Group policies, and no matter how hard I search, I just can't get anytihng that answers my question.

    What I need to do is basically split Servers and clients from each other.

    So I need 2 WMI queries. One which will return true when the installed operating system on the computer is a server (Windows 2008x86, 2008x64, 2003x86, 2003x64) and one query which will return true when the evaluating pc is a client os (xp / vista) ...

    At the moment I am doing each os in it's own WMI filter, which starting to become a mess... for win2003 my query looks something like where caption = 'Microsoft Windows Server 2003, standard edition' or caption = 'Microsoft Windows 2003, Standard Edition x64'

    etc etc etc. but i want to capture all server os on one filter, and capture all client os on another... is there any way to do this?

    Thanks alot for your help

  • #2
    Re: AD GPO WMI Queries

    This way?

    WMI-filter "only servers":
    Select * from Win32_OperatingSystem Where (Caption Like "%server%")

    WMI-filter "only clients":
    Select * from Win32_OperatingSystem Where Not (Caption Like "%server%")



    where % is used for a wildcard character (only when the 'Like' operator is used).

    \Rems
    Last edited by Rems; 26th May 2008, 13:24.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: AD GPO WMI Queries

      Doh!

      ummm... thanks that worked great...

      Comment


      • #4
        Re: AD GPO WMI Queries

        you are welcome

        There are other ways of course for filtering clients.
        Like you could filter by the "domainrole" of the computer
        http://msdn.microsoft.com/en-us/libr...02(VS.85).aspx

        "servers only"
        Select * From Win32_ComputerSystem Where DomainRole > 1

        "clients only"
        Select * From Win32_ComputerSystem Where DomainRole < 2



        But it is good to know there is a 'Like' Operator.
        http://www.microsoft.com/technet/scr...2003/like.mspx
        The LIKE operator determines whether or not a character string matches a specified pattern. The specified pattern can contain exactly the characters to match, or it can contain meta characters. The following table lists the meta characters.

        Character Description
        [ ] Any one character within the specified range ([a=f]) or set ([abcdef]).
        ^ Any one character not within the range ([^a=f]) or set ([^abcdef].)
        % Any string of 0 (zero) or more characters.
        _ Any one character. (note: Because the underscore is a meta character, any literal underscore used in the query string must be escaped by placing it inside [] )

        The Like operator is not available for Windows 2000 and Windows NT 4.0!

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment

        Working...
        X