Checking model of PC
Hi,
Can someone share with knowledge about custom action in MSI, what I need is custom action which checks type of model on XP OS and if it is correct the installs the drivers if not then skips.
I have no idea that there is such but I may think that some of you may know it.
Answers (3)
you can use wmi to get info also
wmic csproduct get name
then use it a a script like:
@ECHO OFF
REM do a wmi query to get the info we want and put it in a variable
FOR /F "tokens=2 delims==" %%A IN ('WMIC csproduct GET Name /VALUE ^| FIND /I "Name="') DO SET machine=%%A
ECHO Computer model: "%machine%"
REM Now we have the model in a variable we can do some logic and run commands, for example...
REM Watch for stray spaces at the end, take out all spaces with: SET machine=%machine: =%
IF /I "%machine%" == "Latitude E6410" (
REM do something specific for an E6410
) ELSE (
REM do something for other types
)
I'm not sure of any native way to make a MSI look for a model. However you can make an easy script to verify the make or model of a workstation prior to installing the MSI package.
Model.vbs
Dim objWMI : Set objWMI = GetObject("winmgmts:")
Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")
Dim colSettingsBios : Set colSettingsBios = objWMI.ExecQuery("Select * from Win32_BIOS")
Dim objComputer, strModel, strSerial
For Each objComputer in colSettings
strModel = objComputer.Model
Next
For Each objComputer in colSettingsBios
strSerial = objComputer.SerialNumber
Next
wscript.echo strModel
wscript.echo strSerial
This will return the SN and model of the computer. If you modify this to do an IF statment to RUN your package when they match, this should do it for you.
If strModel = "ProLiant ML110 G6" Then Call InstallPKG
wscript.quit
Sub InstallPKG
objShell.Run("\\server\share\package.MSI")
end sub
Just modify the code to how you want it. Then just run the VBScript and not the MSI to verify for you if the model matches. You can use other WMI fields to check for OS, RAM, Speed, etc...
Hope this helps.