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

John Savill

September 27, 2007

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 & "rootcimv2")
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. 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like