Page 1 of 1

Silent Install ReturnCode

Posted: Wed Mar 15, 2006 9:57 am
by jzhong
Hi

When performing silent installation using SMS, how could I tell whether my setup is installed successful or not ? The return code from setup.exe is always return 0 even the installation is failed like no enough space, etc.

Thanks

Joe

Posted: Wed Mar 15, 2006 10:32 am
by Ton_B
Hello Joe,

I previously had the same problem.
When you use a silend setup, no dialogs or even error messages are shown.

If you only want to know if a setup has run correctly you can use a logged setup. Simply add the following line to the commandline:

Code: Select all

..\\YourSetup.exe /l=c:\\logfilename.ext


I was not happy with a setup wich would not give you any information of the progress of even pre conditions etc.
So I created my own variable to check if the setup must be attended or unattended.

All the way on the top of my script I added the following code:

Code: Select all

Set variable SILENTMODE to $SILENT$
If SILENTMODE equals TRUE
  Set variable SILENT to FALSE
End


Now you can use the SILENTMODE variable to manually decide what you want to do, and of cource, every messagebox (like errors) will now be shown!
I even edited the progress dialog, wich will be shown in an unattended setup, but does not have any controls on it, so you can see the setup is running.

The only thing you must not forget is to add code like this in the dialogs loop.:

Code: Select all

 if Variable SILENTMODE not Equals TRUE
  wizard loop
    Display Dialog: welcome
    [compiler if Variable BUILDMODE not Equals PATCH]
    Display Dialog: licensecheck
    Display Dialog: readme
    Display Dialog: registration
    Display Dialog: destination
    Display Dialog: startmenu
    [compiler end]
    Display Dialog: startinstallation
  end
GoTo Label: Main Install
[ etc ]
 Display Dialog: progress


hope this helps.

Ton Blokhuizen
BMA BV- Netherlands[/code]

Posted: Wed Mar 15, 2006 12:37 pm
by MichaelNesmith
Very easily done. Use the Terminate with Exit Code command. There you can specify any custom non-zero return code for a variety of error conditions in your setup script. For instance, 1 if prereq installs failed, 2 if setup itself failed, 3 if incorrect command line parameters specified, and so on...

Posted: Wed Mar 15, 2006 3:01 pm
by jzhong
When the installation involves the main setup logic, I know I have the full control by terminate with exit code command and I am doing it currently.

However, in our customer site, the installation run into "Setup resource decompression failure" error and the setup.exe still report success (ie, return 0) using SMS. That is why this question arise, and this is out of my control. Any thought on the solution ?

Posted: Wed Mar 15, 2006 3:44 pm
by MichaelNesmith
Thanks for that report. I'll escalate this to product management so they can make sure a correct error code is returned upon initialization errors.