Announcement

Collapse
No announcement yet.

WMI Filters for desktop computers

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

  • WMI Filters for desktop computers

    Hello,

    I am having issues with my WMI filter.

    I need to have a GP applied to people with desktop computers. This is what I have tried and it did not work.


    select * from Win32_SystemEnclosure where ChassisTypes <> "15"


    select * from Win32_SystemEnclosure where ChassisTypes = 15

    I ran a script to tell me the exact number for my workstation

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colChassis = objWMIService.ExecQuery _
    ("Select * from Win32_SystemEnclosure")
    For Each objChassis in colChassis
    For Each strChassisType in objChassis.ChassisTypes
    Select Case strChassisType
    Case 1
    Wscript.Echo "Other"
    Case 2
    Wscript.Echo "Unknown"
    Case 3
    Wscript.Echo "Desktop"
    Case 4
    Wscript.Echo "Low Profile Desktop"
    Case 5
    Wscript.Echo "Pizza Box"
    Case 6
    Wscript.Echo "Mini Tower"
    Case 7
    Wscript.Echo "Tower"
    Case 8
    Wscript.Echo "Portable"
    Case 9
    Wscript.Echo "Laptop"
    Case 10
    Wscript.Echo "Notebook"
    Case 11
    Wscript.Echo "Handheld"
    Case 12
    Wscript.Echo "Docking Station"
    Case 13
    Wscript.Echo "All-in-One"
    Case 14
    Wscript.Echo "Sub-Notebook"
    Case 15
    Wscript.Echo "Space Saving"
    Case 16
    Wscript.Echo "Lunch Box"
    Case 17
    Wscript.Echo "Main System Chassis"
    Case 18
    Wscript.Echo "Expansion Chassis"
    Case 19
    Wscript.Echo "Sub-Chassis"
    Case 20
    Wscript.Echo "Bus Expansion Chassis"
    Case 21
    Wscript.Echo "Peripheral Chassis"
    Case 22
    Wscript.Echo "Storage Chassis"
    Case 23
    Wscript.Echo "Rack Mount Chassis"
    Case 24
    Wscript.Echo "Sealed-Case PC"
    Case Else
    Wscript.Echo "Unknown"
    End Select
    Next
    Next

    Thanks for your help in advance

  • #2
    Re: WMI Filters for desktop computers

    It cannot be done,
    because the ChassisTypes[] property is stored as an array. That mean a computer can have more than one chassis type (e.g. laptops with docking stations have more than one value in the array).
    It is not possible to use arrays in 'WMI Query Language' (WQL), you'll need a for-next loop - what is not possible for WMI Filters.

    http://forums.petri.com/showthread.p...1280#post81280

    (Your script just shows from the ChassisTypes the first match only, if there happen to be more ChassisTypes, the script wouldn't show them to you.)

    \Rems

    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: WMI Filters for desktop computers

      Here is a nice article about the subject.
      "The Quest for the Holy Desktop WMI Filter

      \Rems

      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