bchernecki
Posts: 4
Joined: Wed Apr 04, 2018 4:16 am

get product code from upgrade code via search

I am in need of a search that gets the particular product code of the previously installed MSI using the upgrade code.

I know this works with the Upgrades feature, but I can't use it for this case because the old .MSIs were not built correctly and don't play well when they run in upgrade mode. In a nutshell they only work for install and uninstall modes.


As such I've opted to manually uninstall the previous .MSI's with the 'Launch EXE With Working Directory' Custom Action. This works great as they simply translate to misexec /x {ca29811c-01c0-44a5-9228-6e6a57e6683e} /qn
msiExec_uninstall.png
msiExec_uninstall.png (29.85 KiB) Viewed 8419 times
However it would be more valuable to able to find the product code dynamically so I only have to have ONE custom action rather than X for each product
misexec /x [product_code_property] /qn

Here are my searches
searches.png
searches.png (7.01 KiB) Viewed 8418 times
Is this possible?

P.S. These aren't the ACTUAL product codes for my installer ;)
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: get product code from upgrade code via search

Hi and welcome to our forums.

I apologize for the delayed reply.

Please keep in mind that in order to automatically uninstall all the versions of a product based on its Upgrade Code, you can simply go in the "Upgrades" page, use the "New Upgrade" toolbar button and add that Upgrade Code there.

If you want to enumerate the products with a specified Upgrade Code you can use the "MsiEnumRelatedProducts" function.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bchernecki
Posts: 4
Joined: Wed Apr 04, 2018 4:16 am

Re: get product code from upgrade code via search

Hello Eusebiu

Thank you for your reply. I am aware of and have utilized the upgrades feature you described. However it does not work for old buggy .MSI that only uninstall during the uninstall mode, not during upgrade mode. Thanks MSIWrapper...

In a nutshell this MSIWrapper tool created a custom action that has a condition REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE. :cry:

So hence why I am manually uninstalling with msiexec.

The MsiEnumRelatedProducts sounds interesting. Could you please expand on how one might utilize this within AI?
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: get product code from upgrade code via search

Hi,

In order to use the "MsiEnumRelatedProducts" function you need cu create a DLL custom action where you call it as described in its documentation. You can create a custom action written in C++ or you can use it as discussed in the thread below:
https://stackoverflow.com/questions/401 ... roductinfo

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”