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

How to uninstall MSI after all chained MSI are installed

Hi,

I have an installer with 3 chained MSI packages. After all chained packages are installed an other software should be uninstalled (if present on computer). The software for uninstall is also MSI based. I have the MSI file too.

How can I handle this? Thank you.

BR
Igor
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: How to uninstall MSI after all chained MSI are installed

Hello Igor,

In order to achieve that, you could have something similar to this article:

How do I uninstall another MSI package when my application is uninstalled?

The easier approach would be through the "Upgrades" page, but I am not sure if the setup will be removed after the chained packages are installed.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to uninstall MSI after all chained MSI are installed

Hello Catalin,

does it also work in my case? I need to uninstall another MSI package when my application is installed.
I mean I tried it already with custom action or on prerequisites page als .BAT scheduled "After the Main Package" but it doesn't work. The .BAT contains "msiexec.exe /x {GUID} /qn". But the .BAT is not executed. Manually executed .BAT is working.

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

Re: How to uninstall MSI after all chained MSI are installed

Just tried as Custom Action as described in the article. It also doesn't work.
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: How to uninstall MSI after all chained MSI are installed

Hello Igor,
I mean I tried it already with custom action or on prerequisites page als .BAT scheduled "After the Main Package" but it doesn't work. The .BAT contains "msiexec.exe /x {GUID} /qn". But the .BAT is not executed. Manually executed .BAT is working.
This should have worked.

Please make sure the custom action is executed at the end of the installation sequence and that it has the "Wait for custom action to finish before proceeding" and "Fail installation if custom action returns an error" option are unchecked.

Additionally, please make sure you have the "Run as Administrator" option checked for your "Launch File" custom action (assuming this is what you're using).

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to uninstall MSI after all chained MSI are installed

Hello Catalin,

solved.

I have changed to Custom Action "Launch EXE with working directory" to run msiexec.exe instead of .BAT.

I also set the Execution Time parameter to "commit" and also Run with full privileges.

I don't know if both options are important but it works now. Thank you.

BR
Igor
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: How to uninstall MSI after all chained MSI are installed

Hello Igor,

Thank you for your follow-up on this.

It's great to hear that everything is now working as expected.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
igi
Posts: 47
Joined: Tue Nov 15, 2011 3:45 pm

Re: How to uninstall MSI after all chained MSI are installed

Hello,

Unfortunately, uninstalling as a custom action no longer works. I have no idea at the moment.

I have defined the custom action "Launch EXE with working directory". As file = msiexec.exe and SystemFolder as working directory and as command line parameter "/x {product id}". This works when it is run locally on the client - the product is uninstalled.

The custom action is defined in "Install Execution Stage" after "Finish Execution". "Run under LocalSystemaccount with full privileges" is enabled, both "Wait for ..." options are disabled.

What I see in the log of the main package:

Code: Select all

MSI (s) (74:48) [09:32:56:520]: Doing action: Uninstall_GS_9.53.3
Action ended 09:32:56: InstallExecute. Return value 1.
Action start 09:32:56: Uninstall_GS_9.53.3.
MSI (s) (74:48) [09:32:56:520]: Doing action: InstallFinalize
Action ended 09:32:56: Uninstall_GS_9.53.3. Return value 1.
MSI (s) (74:48) [09:32:56:520]: Running Script: C:\WINDOWS\Installer\MSI1FD2.tmp
MSI (s) (74:48) [09:32:56:536]: Note: 1: 2265 2:  3: -2147287035 
MSI (s) (74:48) [09:32:56:536]: User policy value 'DisableRollback' is 0
MSI (s) (74:48) [09:32:56:536]: Machine policy value 'DisableRollback' is 0
MSI (s) (74:48) [09:32:56:536]: Note: 1: 2318 2:  
MSI (s) (74:48) [09:32:56:536]: Note: 1: 2318 2:  
MSI (s) (74:48) [09:32:56:536]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1460554781,LangId=1033,Platform=589824,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
Action start 09:32:56: InstallFinalize.
MSI (s) (74:48) [09:32:56:536]: Executing op: ProductInfo(ProductKey={E226E299-F195-4F27-B719-59040CB43BC7},ProductName=AIP-Druckertreiber,PackageName=AIP-Druckertreiber_5.7.2001.msi,Language=1033,Version=84346833,Assignment=1,ObsoleteArg=0,ProductIcon=pic_printer_Andere101.exe,,PackageCode={DF0BA03D-9415-458E-876A-DDC390DDA44C},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
MSI (s) (74:48) [09:32:56:536]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (74:48) [09:32:56:536]: Executing op: DialogInfo(Type=1,Argument=AIP-Druckertreiber)
MSI (s) (74:48) [09:32:56:536]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,,CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (74:48) [09:32:56:536]: Executing op: SetBaseline(Baseline=0,)
MSI (s) (74:48) [09:32:56:536]: Executing op: SetBaseline(Baseline=1,)
MSI (s) (74:48) [09:32:56:536]: Executing op: ActionStart(Name=Uninstall_GS_9.53.3,,)
MSI (s) (74:48) [09:32:56:536]: Executing op: CustomActionSchedule(Action=Uninstall_GS_9.53.3,ActionType=3298,Source=C:\WINDOWS\SysWOW64\,Target=msiexec.exe /x {097B1197-F6F7-4D71-B1B5-8BF4AB31A517} /qn /L*V "C:\windows\temp\gs_unistall.log",)
MSI (s) (74:48) [09:32:56:536]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (74:48) [09:32:56:536]: Note: 1: 2265 2:  3: -2147287035 
MSI (s) (74:48) [09:32:56:536]: User policy value 'DisableRollback' is 0
MSI (s) (74:48) [09:32:56:536]: Machine policy value 'DisableRollback' is 0
MSI (s) (74:48) [09:32:56:536]: Unlocking Server
MSI (s) (74:48) [09:32:56:551]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
1: Uninstall_GS_9.53.3 2: 0 
Action ended 09:32:56: InstallFinalize. Return value 1.
Action ended 09:32:56: INSTALL. Return value 1.

And in the log created by msiexec:

Code: Select all

=== Verbose logging started: 14.08.2023  09:32:56  Build type: SHIP UNICODE 5.00.10011.00  Calling process: C:\WINDOWS\system32\msiexec.exe ===
MSI (c) (78:34) [09:32:56:614]: Resetting cached policy values
MSI (c) (78:34) [09:32:56:614]: Machine policy value 'Debug' is 0
MSI (c) (78:34) [09:32:56:614]: ******* RunEngine:
           ******* Product: {097B1197-F6F7-4D71-B1B5-8BF4AB31A517}
           ******* Action: 
           ******* CommandLine: **********
MSI (c) (78:34) [09:32:56:614]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (78:34) [09:32:59:614]: Failed to grab execution mutex. System error 258.
MSI (c) (78:34) [09:32:59:614]: Cloaking enabled.
MSI (c) (78:34) [09:32:59:614]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (78:34) [09:32:59:614]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (c) (78:34) [09:32:59:614]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (78:34) [09:32:59:614]: MainEngineThread is returning 1618
=== Verbose logging stopped: 14.08.2023  09:32:59 ===


Where is my problem?

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

Re: How to uninstall MSI after all chained MSI are installed

Solved again :roll:
Added the upgrade code of the old MSI to the Upgrades Page.
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: How to uninstall MSI after all chained MSI are installed

Hello Igor,

Thank you for your followup on this!

I am glad to hear everything is working as expected now.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”