We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Forcing a silent installation to fail

I have a VBScript Execute Inline Script Code custom action which runs an executable which returns 1 or 0 and sets a property based on that value. When using the UI I can check that value and stop the user from advancing through the dialogs when the aforementioned property is 0. When running silently I would like to fail out the installation but I cannot figure out a way to do so. I've tried a division by 0 and a non-existent variable name using option explicit and WScript.Quit 3, but nothing will prevent the installation from continuing along (I've added MsgBoxes for the time being to ensure that the script is actually executing).

Code: Select all

If output = 0 Then
	Session.Property("MY_PROPERTY") = "1"
  LicenseSilent = 1
Else
  MsgBox myVar
   ' myVar = 1 / 0
   ' fail
   WScript.Quit 3
  MsgBox "Did I quit?"
End If
There is the relevant logic, I change which of the 3 lines is commented out to try to force a failure (I have "Fail installation if custom action returns an error" checked).

I'm executing the msi with /qr for testing purposes, not sure whether this has anything to do with it. Any help would be most appreciated.

- Adam
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Forcing a silent installation to fail

Hello Adam,

Please use the approach exposed in our "Exit installer if same version is found" thread which debates a similar issue.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Re: Forcing a silent installation to fail

Thank you once again Daniel, this worked as expected. I'm curious as to why the inline script's error is suppressed, however. If you have any insights I'd be keen to hear them. If not, thank you very much for the fix!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Forcing a silent installation to fail

You're welcome Adam.

Also, I apologize for my delayed reply, but we are quite busy at the moment.

This is by design. Our "Execute inline script code" custom action is the equivalent of the Windows Installer "Type 38" predefined custom action and this custom action always returns success. Our "Launch attached file" custom action (when targeting a VBS file) is the equivalent of the Windows Installer "Type 6" custom action and this custom action can return any of the values exposed in "Return Values of JScript and VBScript Custom Actions" article.

Starting with an "Enterprise" project type or higher you can verify the type of your custom actions added in "Custom Actions" page by checking the "Table Editor page -> CustomAction table -> Type column". Also, please take a look on the "Custom Action Types" article.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”