cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Christoph
Level 8

Return error code from failed msi to vbscript

I have a parent msi installer where I call a vbscript that calls a silent install of a child msi. Both msi installers are written by me...

The vbscript looks like:
call objShell.Run(strPath,0,true) where strpath = msiexec.exe /i "child.msi" /qn /norestart /L*v .

If the child msi fails at some point, it rollbacks and the parent process continues... without informing the user that something went wrong.

Is there a possibility to pass a returncode from the child msi to the calling vbscript (and from the vbscript to the calling parent msi)?
Is some property is setted when during a silent install a rollback has been initiated or something else...?

Thanks!
Labels (1)
0 Kudos
(1) Reply
MichaelU
Level 12 Flexeran
Level 12 Flexeran

This is fully up to you, within the constraints of Windows Installer. Msiexec.exe will return a code similar to those returned from MsiInstallProduct (e.g. 0 for success, 1603 or similar for various errors), and I assume that vbscript will give you a way to access this. However if you return an error code from a custom action in the outer project, it will immediately fail the outer installation. If you're in an immediate action, you can probably set a property that can be shown on a dialog. Otherwise about all you can do is call Session.Message to inform the user (if the outer installation is being run with UI), and then return either a success or failure code, respectively allowing the outer installation to continue, or causing it to abort and likely roll back.

Windows Installer isn't all that well suited for installing multiple packages this way; it may be worth examining a bootstrap-driven approach (such as using prerequisites in your Basic MSI project or using a Suite project).
0 Kudos