So, this is an 'archaic' method of doing a silent MSI install/uninstall but it worked for us!
We have an "updater" VB6 applications that checks files on our test server and compares them to the files on your hard drive. If the application detects a change, then it updates your file with the version on the server.
This application only deals with OCXs, EXEs and DLLs. Since our new environment is all .NET, I needed to add MSI packages to the list (I know I could've done a straight copy but I need to do some COM registration for interop). The question is how can I get information regarding the MSI? Enter the WindowsInstaller.Installer object!
To keep things as simply as possible, I used the Revision Number Summary Property of our MSI to check for package code differences. This way, the application an programmatically uninstall the old package and install the if there is a new package GUID. Originally, this process was accomplished using the Shell function within VB6. However, this method caused some errors since it did not wait for the MSI installation to finish before launching the host application.
Any way, after looking around on the internet for examples, this is what I came up with (VBScript):
' Create the Installer object
Dim msi
Set msi = CreateObject("WindowsInstaller.Installer")
' Get the paths for the MSI files to check out
dim newPath
newPath = "new.msi"
dim oldPath
oldPath = "old.msi"
' Get the information for the MSI packages
dim newInfo
set newInfo = msi.SummaryInformation(newPath)
dim oldInfo
set oldInfo = msi.SummaryInformation(oldPath)
' Get the revision numbers
dim newRevNum
newRevNum = newInfo.Property(9)
dim oldRevNum
oldRevNum = oldInfo.Property(9)
' Check if they're different
' Things could be better here, but it works
if(oldRevNum <> newRevNum) then
msi.InstallProduct oldPath, "REMOVE=ALL"
msi.InstallProduct newPath, ""
end if
Don't worry, this is just temporary (yeah, I know famous last words!!). Our next step is to re-write this .NET. Perhaps, PowerShell or MSBuild? Who knows!! ;-)