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.
How can I create a WMI filter for only certain computer makes?
September 27, 2007
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.
You May Also Like