Software Deployment Question

Custom Action to include a batch file

11/05/2014 3165 views

As required, I will have to create a msi installer of Java 6 Update 27 (forget about vulnerabilities) that needs all other versions of Java installed on the host. I have my batch file created using wmi command that uninstalls all the java versions installed on the machine. And, I have the msi installer extracted from the java setup. On the install shield editor I see a custom action to include VBScript but not regular windows script. Could some one help me in getting this done?. We use Flexera Admin Studio for repackaging software applications.

5 Comments   [ + ] Show comments


  • To add, my installer should uninstall all other versions of java.
  • So...your MSI needs "all other versions of Java installed on the host." and then your batch file "uninstalls all the java versions installed on the machine."

    That sounds like a monumental waste of time to me!

    As to running batch, a clue: run CMD.EXE with the name of the batch file as an argument.

    As to whether doing this via batch is a good idea, it's really not. Besides any other consideration, batch is truly awful at error-trapping. Use your deployment system to uninstall older versions of apps/utilities.
    • Why won't this idiot forum software process multiple carriage returns?!?!? I use paragraphs for a reason!!!
      • VBscab,

        I apologize if my typo error has confused you. My msi needs to uninstall all other versions installed already on the host first and then it needs to install the specified version. So I am intending to run the batch file first as a custom action and then install the actual software.

        Please let me know if this doesn't make any sense.

  • I would totally agree with VBScab that using a batch file solution is just asking for problems as the error handling is totally crap and consequently ANY error in the process is likely to prevent all old versions being uninstalled. I would strongly recommend coding the uninstaller in vbscript and checking exit codes after each uninstall, and log the results either to a logfile or the event viewer. It also gives you the opportunity to abort the install if the uninstall does not complete successfully. VBScript is also natively supported in MSIs (with a few limitations) so you reduce the number of other issues you have to program for.
  • Just a thought - isn't there an uninstaller for old versions of Java available from Oracle?
    • EdT, Thanks for your response. In answering to your question, Oracle doesn't provide any uninstallers to uninstall the older versions of java. Also, I am not quite familiar with VBScripting. That is the reason why I am trying to stick with the WMI command to uninstall the other versions. The process that I am doing is , I have the java 6 update 27 msi installer with me. And, I have the batch file containing the WMI commands to uninstall all the versions installed already on the host. I am editing the msi using Installshield editor and trying to include my batch file in to custom actions. If do this successfully , my msi will perform two different operations 1) Uninstall all the java versions installed 2) install the java version 6 update 27. Please add your thoughts.
      • There is actually a java uninstaller at Java.com but it is a web app that needs to be run from their site. However, I wonder whether the code could be grabbed and run locally....
  • A thought...

    Since the JRE MSIs aren't proper MSIs at all, just a vehicle for a ZIP and a bunch of CAs to extract the files, etc., and since your goal is to obliterate all previous versions, why not build a very simple uninstalling MSI by populating the RemoveFile and RemoveRegistry tables? In the latter, you can include the Product Codes which branche from the 'Uninstall' branch by refererence to the installations you have.
    • Thanks VBscab for your suggestions. I will try this out to see if it works.


All Answers

One way I can think of is, add the batch file in your MSI. Install it to Temp folder and then use a custom action to execute that batch file. You might have already thought of this, but still felt like sharing with you. This is just a workaround.
Answered 12/29/2014 by: Rahul.C.Gaikwad
White Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ