igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Uninstall of two installed MSI prerequisites

Hi,

I'm using AI Java. I defined in my project two prerequisites (MSI). The installation runs fine, the main package and both MSI packages are installed.

On uninstall of main package I want remove both MSI packages. I defined under custom actions - InstallExecuteSequence - InstallFinalize two actions of type EXE with working directory with command "msiexec.exe /x {GUID} /qb" and expression (REMOVE="ALL").
But I get an error on uninstall. Windows installer is not able to to perform the action becouse it is still running (main package unnistall).

How to solve it?

Best regards
Igor
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Uninstall of two installed MSI prerequisites

Hi Igor,

For this scenario I recommend the usage of chained packages, this way the install and uninstall process will be handled completely by Windows Installer, without any custom actions from your part being required.

If want to continue using them as prerequisites then the uninstall will require a little more work. This happens because Windows Installer engine does not allow for two MSI packages, install/uninstall, to run at the same time. So you will need to create an EXE or DLL custom action that launches the uninstall process one by one, not simultaneously. This EXE custom actions should be scheduled under InstallFinalize, as you did, but set with "Asynchronous execution, do not wait for return". So the main installer can launch the custom action and then finish its uninstall process.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hello Bogdan,

thank you for your response. I would like to use chained packages but we just bought 2-years maintenance for Java license :(

So the second way...

I changed the EXE custom action to "Asynchronous execution, do not wait for return" but I get attached error now.
Installer_Problem.png
Installer_Problem.png (3.79 KiB) Viewed 11124 times

Best regards,
Igor
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Uninstall of two installed MSI prerequisites

Hi Igor,
I would like to use chained packages but we just bought 2-years maintenance for Java licens
You can purchase an upgrade to Enterprise and the maintenance will also be automatically upgraded too.
http://www.advancedinstaller.com/upgrade.html
I changed the EXE custom action to "Asynchronous execution, do not wait for return" but I get attached error now.
First thing you need to understand, that without creating your custom EXE file that launches the uninstall processes and waits after them, you
can use the custom action mentioned in the first post to uninstall a single package. If you add two custom actions you would launch the uninstall for both packages simultaneously and the same problem with the Windows Installer limitation would appear.

Regarding the error message you attached, this is a generic message give by Windows Installer when a custom action fails, not very helpful.
Can you please attach the project file too, or send it to us by e-mail at support at advancedinstaller dot com?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hi Bogdan,

OK, now I understand it. Can be this own EXE a Batch-File (BAT)? Can I put both msiexec uninstall commands into one own EXE?
I attached the project file too.

Thank you,
Igor
Attachments
AIP-Druckertreiber.aip
(21.76 KiB) Downloaded 372 times
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Uninstall of two installed MSI prerequisites

Hi Igor,

I see you have multiple custom actions in the package, so I don't know for sure which one fails, only a verbose log can tell us. I suspect that is one of the custom actions launching the BAT files, as it has not execution condition, so you are practically trying to launch during uninstall a file that normally was removed at this stage of the uninstall process.
Can be this own EXE a Batch-File (BAT)? Can I put both msiexec uninstall commands into one own EXE?
Yes, you can use EXE, BAT, Win32 DLL or VBScript, as long as you can launch the "msiexec" calls one a t turn, i.e. you need to launch the first one, wait for it to finish, check a return code or some other method, and only than launch the second process.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hi Bogdan,

I created the VBS script but I am not so familiar with the product.
I understand this sentence not quite:
- Use the Custom Action in the project as a "DoAction" Event with the "WriteToLog" Argument
and
- Run the installation package with logging enabled

Regards,
Igor
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Uninstall of two installed MSI prerequisites

Hi Igor,

Here is an article you can follow to help you understand this.

Since you are new, I highly recommend you read our tutorials for a better understanding of how to use Advanced Installer to efficiently deploy your products.This will also help you better understand support team's suggestions now and in the future. The Simple and Professional tutorials are especially important.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hello Mihai, hello Bogdan,

thanks. Now it works perfect.

How is the best way to put this custom EXE file that launches uninstall processes of external MSI's in InstallFinalize custom action that will not be removed during main uninstall process?

Best regards,
Igor
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Uninstall of two installed MSI prerequisites

Hi Igor,

Simply add the EXE as "New attached custom action". This will make the package to include it in its Binary table, so it will be available at any step of the install and uninstall processes.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hi Bogdan,

it doesn't work (nothing happens on end of uninstall).
AI_custom_action.png
AI_custom_action.png (58.48 KiB) Viewed 11106 times
Only if I define "EXE with working dir" custom action the BAT is executed. I attached a new project file if you want to watch it.


Best regards,
Igor
Attachments
AIP-Druckertreiber.aip
(75.77 KiB) Downloaded 389 times
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Uninstall of two installed MSI prerequisites

Hi Igor,

I thought you said you are using an EXE, not a BAT file, this is why I recommended the attached custom action.

For BAT files is a little more complicated, you need to first add the file as a temporary one, in Files and Folders page, and then launch as explained in the following article:
http://www.advancedinstaller.com/user-g ... -file.html

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hi Bogdan,

it still doesn't work with temp. file and launch file predefined custom action :(
AI_temp_file.png
AI_temp_file.png (23.05 KiB) Viewed 11107 times
AI_launch_file.png
AI_launch_file.png (66.5 KiB) Viewed 11107 times
Best regards,
Igor
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Uninstall of two installed MSI prerequisites

Hi Igor,

As mentioned in the article my colleague included in his last post, any temporary file is removed after InstallExecuteSequence -> InstallFinalize. In your case the .BAT file doesn't seem to be present on the target machine when the custom action is executed.

The solution would be to schedule the "Launch File or Open URL" custom action before InstallFinalize. You can try to schedule it after InstallIIS and see the outcome.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: Uninstall of two installed MSI prerequisites

Hi Mihai,

I think I couldn't solve it without chained packages.
As described here http://www.advancedinstaller.com/user-g ... l-msi.html, I have to schedule the custom action under "InstallFinalize". It works if the BAT file is present on target computer. If the BAT is temporary file, it is launched on end of uninstall of the main package but closes after any seconds during execution of the first from two msiexec commands. I think it happens at the time the temporary file was deleted from target computer.

I will copy the BAT file to target computer on uninstall process and delete it on next boot. This should be possible?

Thank you guys. You are really great.

Best regards,
Igor

Return to “Common Problems”