6

I have lost the GUID's for my old installer. I managed to get the upgrade id using Orca but it still does not remove the old version from the programs and features list. How can I uninstall an old msi/bootstrapper with a completely new one?

ecw5
  • 61
  • 1
  • 2

3 Answers3

11

If you have a MSI to uninstall (i.e. not a bootstrapper) then you should be able to uninstall it with WIX <Upgrade> element, by specifying it there like that:

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is installed." />

<Upgrade  Id="{YOUR-OTHER-STUFF-GUID-HERE}">
  <UpgradeVersion OnlyDetect="no" Property="OTHER_STUFF_FOUND" Minimum="0.0.0" />
</Upgrade>

If you have some EXE to uninstall, not MSI, then AFAIK only a custom action is a solution (just execute the uninstall line using custom action).

Nikolay
  • 10,752
  • 2
  • 23
  • 51
  • 2
    Thank you so much for this gem, it saved my life today (figuratively, of course) :) – paracycle Apr 19 '16 at 23:00
  • If you don't know how to find the GUID, here's how: https://stackoverflow.com/questions/29937568/how-can-i-find-the-product-guid-of-an-installed-msi-setup – eddex Apr 27 '20 at 07:30
1

-Make use of the windows installer API: MsiEnumRelatedProducts() to get a list of all the products that share the same UpgradeCode.

https://msdn.microsoft.com/en-us/library/aa370103(v=vs.85).aspx

This API returns the product code of all the products installed on the system that share the same UpgradeCode.

You can probably see examples of the usage of this over the internet or Windows installer SDK.

Also, there was one related question recently:

WiX - Allowing a *manual* uninstall of one msi to uninstall another msi that shares the same UpgradeCode (and not just during the MajorUpgrade)

-The other approach is to upgrade your old msi package using the new msi package.

http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html

halfer
  • 19,824
  • 17
  • 99
  • 186
Kiran Hegde
  • 680
  • 4
  • 14
0

Another way would be reading Uninstall key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall) from registry and look for your application name / publisher and if match found execute the UninstallString command.

hypheni
  • 756
  • 3
  • 17
  • 37