12-08-2023 07:52 AM - edited 12-08-2023 07:55 AM
I have a LabVIEW-built application which is distributed to many customers using an installer.
I want to modify the installer so that it performs an operation when the application is UNINSTALLED. So naturally, I am making use of the "Run executable before uninstallation" function in the LabVIEW-built installer. And it works.
The problem is that this exe also gets executed when the customer is UPDATING their installation. If the customer runs a new version of the installer, it essentially does an uninstall and then reinstall. So the executable gets called during an update. I only want this exe to function when the application is actually being removed (ie through Add/Remove Programs).
Any thoughts on this? I was hoping maybe I could use some kind of command line parameter so that the exe can determine if it was called from an UPDATE or UNINSTALL. But I can't think of any params that would do this.
Solved! Go to Solution.
12-09-2023 07:03 AM
A quite obvious question: What did you use to create that additional executable? And did you already try to see if it gets passed any command line parameters from the installer itself without any additional work required from you?
12-11-2023 08:01 AM
The installer is Labview-built. And the executable it calls is also LabVIEW-built.
Command line parameters would seemingly be the solution. But I have tested this thoroughly and it doesn't receive anything useful. The installer can send the INSTALLDIR, which is received by my EXE, but that is not helpful for my problem. And DISTROOT fails to send anything at all (empty string).
I am stuck here. I think my only solution would be to switch to a different installer builder, which is not worth the effort.
12-11-2023 05:04 PM
Perhaps a dumb workaround, but what about this...
Let's call your "exe to run on actual uninstallation" your "Business executable".
Make a third exe file, call this one "Uninstaller Assistant". Set your build to run this before uninstallation. Uninstaller Assistant places Business Executable in the "Windows Startup" location to run automatically after the next reboot. (Also set Business Executable to to delete itself after the NEXT reboot.)
Make yet another exe file- "Installer Assistant"- that will run during installation. Installer Assistant checks the Windows Startup area for Business Executable; if it's there, delete it.
You'll need to require a reboot after upgrading or uninstalling to finish the process. If the user is running an actual Uninstall, then Business Executable will run on the next reboot. If they're just upgrading, then it won't run on the next reboot.
I haven't forced a reboot before, but it looks like you can edit the .ini of the installer file to make that happen: https://forums.ni.com/t5/LabVIEW/How-di-I-prevent-an-automatic-computer-restart-after-exe-install/td... (I'll admit I just skimmed that post)
12-12-2023 08:24 AM
>>Perhaps a dumb workaround
Not at all! Great idea! Your solution might sound a bit complex, but it could be simplified by using batch files for the "Installer Assistant" and "Uninstaller Assistant".
I'll give this a shot.