Exit the installation with Custom Exit code
Updated: 27 Jul 2010 | 5 comments
Hi,
I am currently preparing a installation for one of my application. The installation should exit if any Excel process is found running. I am able to accomplish this. I am exiting using the Terminate Installation action (Type 19). However, it exits with the exit code 1603.
Here I want the installation to exit with a custom Exit code which I will be catching from external applications.
Any help or leads would be greatly appreciated.
Sireesha
discussion Filed Under:
Comments
I am unaware of any method by which you can return a specific exit code when an MSI terminates.
Unless any other forum member knows of a cunning method to do this, you are going to have to use a somewhat less elegant solution.
What I would propose is that you allocate a specific registry key (or file ) in which to write your exit code, and then have your external applications read this registry key to determine what action needs to be taken if the MSi exits with code 1603.
A somewhat different approach is possible if you have Wise Installation STUDIO or Wise Package STUDIO. In this approach, you test for the Excel running processes using a Wisescript and if any are detected, you can set the exit code when you terminate the wisescript. If no excel processes are detected, you "install" the MSI into the TEMP folder and run it from there, then clean up the temp folder and exit.
The Dragonsoft website has example wisescripts which report running processes using DLL calls, to get you started.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
I will suggest the same as EdT said.
Create a Wise script EXE which will check for the exit code and then if it is 1603 change the same to 0 or 3010
Please find a sample script approch
***********************************************************************************************
Set variable PROCEXITCODE to ""
Execute ProgramMSIEXEC /i "%INST%\%PROJECTNAME%.msi" /qb-! /l*v
If PROCEXITCODE=1603
Set Variable PROCEXITCODE to 0
End
***********************************************************************************************
Thanks and regards
Paachu
Not quite
PROCEXITCODE is a predefined variable which you can certainly use WITHIN the wisescript but is of no use to any external program waiting for an EXIT Code from the Wisescript EXE.
So you can certainly interrogate PROCEXITCODE within the wisescript, but if you want to have control over the EXIT Code of the Wisescript EXE, then you need to set the exit code in the "Exit Installation" command.
Also, it is irresponsible to suggest 3010 as an exit code in this scenario. This exit code, as VBScab has pointed out, indicates that a reboot is required.
So here we have an application that tests if any Excel processes are running, and if so, let's return a "Reboot required" exit code. That is one sure way of terminating your IT career if you happen to work anywhere near a trading floor. You'd be lucky to escape with only mild burns from the tar and feathers.....
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
:-)
Requester wants the error code to be captured and then give a custom value. First part is working for me in case of MSI's
Setting our Wise EXE exit code through Exit Installation action is good knowledge for me.. Thanks
Thanks and regards
Paachu
I wouldn't use 3010...
...since that is the return code indicating that a reboot is required which, in the case of, say, a 1603, almost certainly isn't the case and indeed were it to be acted upon in THIS case (where the only "problem" is that Excel is running) is likely to result in users storming the IT department with flaming torches and pitchforks.
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
Would you like to reply?
Login or Register to post your comment.