Skip navigation

How can I create a WMI filter for only certain computer makes?

A. The best way to check the hardware is to check the manufacturer and model information from Win32_ComputerSystem. For example, to check for the Dell M65 and 820, I could use

Select * from Win32_ComputerSystem WHERE manufacturer LIKE "Dell%" AND (Model LIKE "%820%" OR Model LIKE "%M65%")

To check the make and model of a machine, you could run the following script:

strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colSettingsComp = objWMI.ExecQuery("Select * from Win32_ComputerSystem")

For Each objComputer in colSettingsComp
Wscript.Echo "Model - " & objComputer.Model
Wscript.Echo "Manufacturer - " & objComputer.Manufacturer
Next

Here's the script in action:
.

D:\Temp>cscript checkhardware.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Model - Precision M65
Manufacturer - Dell Inc.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish