It's not a secret anymore!*
The moose likes General Computing and the fly likes Installing, updating and removing two msi files in one action. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Installing, updating and removing two msi files in one action." Watch "Installing, updating and removing two msi files in one action." New topic
Author

Installing, updating and removing two msi files in one action.

Jan de Boer
Ranch Hand

Joined: Dec 10, 2010
Posts: 415
    
    1
I have a very simple assignment, and after one week, and yes I feel ashamed, I still have not found the solution... The task is very simple. The customer has to install/update two msi files. But, they are lazy, and want to do it with one click. I have come over tons of information about nested msi. Advice not to use that. I tried to use Installshield. It installed, but did not update nor removed correctly. I have thought about just calling two msi installs from a command script but there is not real easy way to let the second msi wait for the first msi install to finish. I am getting a little frustrated now, and depressed. Such a simple assignment and I am still pondering about the solution. Is there any simple solution? For your interest, even the order in which these installs are run, is not that important. It are quite independent things. The only requirement is that install, remove and update goes in one action.
Jan de Boer
Ranch Hand

Joined: Dec 10, 2010
Posts: 415
    
    1
Okay, I made this goofy but efficient solution. There is an overwhelming chunk of information for this problem, and the packages like installshield are just bloated. This is simple and short and good enough I think. It's just a bit of vbscript.

set fso = CreateObject("Scripting.FileSystemObject")

dim currentDir
currentDir = fso.GetAbsolutePathName(".")
set oFldr = fso.getfolder(currentDir)

for each ofile in oFldr.Files
if lcase(ofile.name) = "setup.ex_" then
ofile.name = "setup.exe"
end if
if lcase(ofile.name) = "mymsi.ms_" then
ofile.name = "mymsi.msi"
end if
next


dim arrMSI(1)

arrMSI(0) = "msiexec /i mymsi.msi /norestart"
arrMSI(1) = "setup.exe"


for each item in arrMSI

'run each program (or in your case MSIEXEC command), wait till exit.
'If installer returns exit code 0, then continue to next

set WshShell = WScript.CreateObject("WScript.Shell")
return = WshShell.Run(item,1,true)

if return <> 0 then

wscript.echo item & " failed. Script will now abort."
wscript.quit

end if

next


set fso = CreateObject("Scripting.FileSystemObject")

set oFldr = fso.getfolder(currentDir)

for each ofile in oFldr.Files
if lcase(ofile.name) = "setup.exe" then
ofile.name = "setup.ex_"
end if
if lcase(ofile.name) = "mymsi.msi" then
ofile.name = "mymsi.ms_"
end if
next
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Installing, updating and removing two msi files in one action.