You may have a need to limit where your VBScript runs based on the model name of the PC it’s running on. Maybe you only want to run it on a Dell Optiplex GX280, for instance. The following code uses WMI to attempt to identify the PC’s model name, if it has one. If a model name is found, its text is returned. If not, the string "<UNKNOWN>" is returned.
'
' Get the PC's model
'
'
function getPCModel(strComputer)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
theValue = ""
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
theValue = objItem.Model
Next
getPCModel = theValue
end function