Execute an EXE (contains 3rd party MSI) during Installation

sheeeng's picture

Hi,

I'm using Wise Installation Studio 7.0.

How do I execute a 3rd party EXE file which contains 3rd party MSI during installation using Wise Installation Studio?

For uninstallation, how to I call the 3rd party EXE file with /X (MSIEXEC Uninstall Command Switch) to uninstall all the related files installed by it?

Note that the 3rd party EXE file is not build using Wise Installation Studio.

Thanks in advance.

AngelD's picture

How would we know? There is

How would we know?
There is no valid argument(s) that fits all executable in general.

Try to find out the valid arguments for the exe.
Is it a:
wisescript compiled exe?
installshield exe wrapper?
inno setup build exe?

EdT's picture

Not enough information

You cannot install an MSI, whether or not it is in EXE format, from the InstallExecute sequence, except as a nested custom action.
Your best bet is to use a wisescript wrapper to handle the install and uninstall of your app and also the EXE, in whatever sequence is required. However, you will have to find out the necessary command line options to install and uninstall your EXE silently for this to work.
The silent EXE install information should be provided by the application vendor. Once it is installed, it will presumably have an entry in Add/Remove programs, so you will be able to find the UninstallString entry in the registry which relates to the MSI product code of the MSI embedded in the EXE. To uninstall the MSI, once you have found the product code, is quite simple.
msiexec /x {ProductCode} /qn

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

sheeeng's picture

Illustrate my situation

Hi AngelD & EdT,

Let me illustrate my situation.

I know how to use Wise Installation Studio to come out with basic installer. After installation, the INSTALLDIR are listed as below.

%PROGRAMFILES%\AmceApp\JohnDoeAppSetup.exe

After executing JohnDoeApp.exe after Wise Installation,

%PROGRAMFILES%\AmceApp\JohnDoeAppSetup.exe (3rd party installer that contains JohnDoeApp.exe & JohnDoeApp.dll)
%PROGRAMFILES%\AmceApp\JohnDoeApp.exe
%PROGRAMFILES%\AmceApp\JohnDoeApp.dll

How to configure Wise Installation Studio to execute JohnDoeApp.exe automatically during Wise Installation? and also uninstalls it during Wise Uninstallation?

EdT, could you give me some hints on using WiseScript as I'm not familiar with WiseScript?

Thanks in advance.

EdT's picture

If you know what files and

If you know what files and registry entries are installed by your JohnDoeApp.exe, why not just add these resources to your base MSI - then you don't need to mess around with finding a different solution.
Freeware capture tools such as InCtrl5 can help you determine what is installed by the JohnDoeApp if you don't have the full information.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

sheeeng's picture

Thanks for InCtrl5 Tips!

Hi EdT,

Thanks for your reply. "JohnDoeAppSetup.exe" is not that simple. It contains many executables, libraries, few Windows Services, etc.

It will be good that we can just use the "JohnDoeAppSetup.exe" to uninstall by itself.

By the way, thanks for the InCtrl5 tips!

sheeeng's picture

WiseScript Question

Hi EdT,

I'm using WiseScript Editor. I'm not sure I'm doing it the right way. Please advice. Thanks in advance.


...
item: Remark
  Text=The following two lines reset COMMON and MAINDIR to short filesnames. This is for backwards compatibility.
end
item: Set Variable
  Variable=COMMON
  Value=%COMMON%
  Flags=00010100
end
item: Set Variable
  Variable=MAINDIR
  Value=%MAINDIR%
  Flags=00010100
end
item: Remark
end
item: Check if File/Dir Exists
  Pathname=JohnDoeApp.exe
  Flags=01000100
end
item: Execute Program
  Pathname=%MAINDIR%\JohnDoeAppSetup.exe
  Command Line=/q /x
  Default Directory=%MAINDIR%
  Flags=00000010
end
item: End Block
end
item: Remark
end
item: Execute Program
  Pathname=%MAINDIR%\JohnDoeAppSetup.exe
  Command Line=INSTALLDIR="%MAINDIR%" /L* "JohnDoeAppSetup.log"
  Default Directory=%MAINDIR%
  Flags=00000010
end
item: Remark
end
item: Remark
  Text=This IF/THEN/ELSE reads the correct registry entries for shortcut/icon placement
end
item: Check Configuration
  Flags=10111011
end
...
EdT's picture

Does it work?

The bit of code you have posted looks OK - but does it work for you?

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

sheeeng's picture

WiseScript does not work

Hi EdT,

The WiseScript manage to execute the below.

 

Command Line=INSTALLDIR="%MAINDIR%" /L* "JohnDoeAppSetup.log"

However, it never execute the below when JohnDoeApp.exe is found.

Command Line=/q /x

Please advice. Thanks in advance.

 

 

 

 

 

EdT's picture

Test manually

Have you verified that the command line arguments work when run manually?
Are you including the full path to the executable?

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

EdT's picture

Coding error?

I had another look at your remove code, and I think there is a missing path. This is what you have:

item: Check if File/Dir Exists
  Pathname=JohnDoeApp.exe
  Flags=01000100
end
item: Execute Program
  Pathname=%MAINDIR%\JohnDoeAppSetup.exe
  Command Line=/q /x
  Default Directory=%MAINDIR%
  Flags=00000010
end

This is what you should have:

item: Check if File/Dir Exists
  Pathname=%MAINDIR%\JohnDoeApp.exe
  Flags=01000100
end
item: Execute Program
  Pathname=%MAINDIR%\JohnDoeAppSetup.exe
  Command Line=/q /x
  Default Directory=%MAINDIR%
  Flags=00000010
end

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

sheeeng's picture

Thanks for the missing path

Thanks, Edt! I missed that out on the missing path.

But it didn't work the way that I wanted it to do. It removes JohnDoeApp.exe, etc. and reinstalls the JohnDoeAppSetup.exe during re-installation.

By the way, do you know of any variable or flag to know when the flow is INSTALL or UNINSTALL (without using the INSTALL.LOG with no error prompt)?

Sadly, the JohnDoeAppSetup.exe /q /n also indirectly removes the INSTALL.LOG.

Thanks in advance.

EdT's picture

No flag

There is no flag or variable to report install or uninstall in your scenario, but there is nothing stopping you setting up your own flag by writing something in the registry during an install phase, and removing it during an uninstall phase.

The other way you could handle this is to require a command line parameter for your wisescript to perform the uninstall, eg  yourinstaller.exe /REMOVE

Anything passed on the command line of the wisescript EXE ends up in the %CMDLINE% variable, which you can then test or parse as required. Just bear in mind that some tests are case sensitive unless you use the "ignore case" option.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

sheeeng's picture

Thanks

 Hi EdT,

I did a workaround with *.CMD and *.REG files to cleanup all the changes made by JohnDoeAppSetup.exe.

I run that *.CMD to uninstall instead of using WiseScript to uninstall.

I know that this is a BAD workaround.

EdT's picture

If it works...

If your solution works reliably and you are happy with it, then it's not a bad workaround.
Nothing to stop you working on this at a later date to improve the way it works, when the pressure is off.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

sheeeng's picture

Thanks

Hi EdT,

Thanks for all the help extended to me along the way. Appreciate it very much!