Hi,
we use conditions in many cases.
For staying at the model we use the conditions to find a specific model and exit the script with a defined exit code. This exit code is used to trigger the condition.
REM ****************************
REM Find Model HP Workstations
REM ****************************
FOR /F "tokens=*" %%i IN ('WMIC Computersystem get model^ /value ^| FIND "6000"') DO (Exit 3)
FOR /F "tokens=*" %%i IN ('WMIC Computersystem get model^ /value ^| FIND "8000"') DO (Exit 4)
FOR /F "tokens=*" %%i IN ('WMIC Computersystem get model^ /value ^| FIND "6200"') DO (Exit 5)
FOR /F "tokens=*" %%i IN ('WMIC Computersystem get model^ /value ^| FIND "Z400"') DO (Exit 6)
FOR /F "tokens=*" %%i IN ('WMIC Computersystem get model^ /value ^| FIND "Z820"') DO (Exit 7)
This is a little script we use for driver installation. How you can see, if exit 3 is given back we install package for the model 6000.
The exit code can be defined by yourself.
For your vb-query following code should give you the exit code (in this example only build for model 6200):
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputerSystem = objWMIService.ExecQuery ("Select * from Win32_computersystem")
Set colBIOS = objWMIService.ExecQuery ("Select * from Win32_BIOS")
For each objComputerSystem in colComputerSystem
GetComputerManufacturer = objComputerSystem.Manufacturer
GetComputerModel = objComputerSystem.Model
If objComputerSystem.Model = "HP Compaq 6200 Pro MT PC" then wscript.quit 6200
next
As High Tower mentioned, buildung such structure can be very complex and yes maybe a script doing all the things can be easier.
Regards