Page 1 of 1
Upgrade with custom uninstallation logic
Posted: Mon Apr 02, 2012 8:06 am
by lpperras
I read in the documentation that if we have custom logic in our uninstallation, we should run the setup .exe file with the right parameters to uninstall it silently.
If your InstallAware setup has custom uninstallation logic, try uninstalling it using the Run Program command and an uninstallation command line, assuring that your custom logic executes.
I understand that part, but do I uninstall using the new setup.exe file, or is there a way to get the old one and call that one instead? If I call the new one, will it find the persisten variables from the old setup? How do I find the complete path of the .exe to execute so that I can pass this to Run Command?
Thanks,
Louis
Re: Upgrade with custom uninstallation logic
Posted: Mon Apr 02, 2012 11:21 am
by FrancescoT
Dear Louis,
plaese excuse me, but it is clear to me your question.
Can you try to describe it with an example?
I understand that you would like to proceed with a "custom logic in your uninstallation", but I missed your target.
Regards
Re: Upgrade with custom uninstallation logic
Posted: Mon Apr 02, 2012 11:30 am
by lpperras
I want my custom logic to be executed when a previous version is discovered. In the documentation, it says to run the setup.exe with the silent uninstall arguments. How do I get the .exe full path to execute it and will it remember the persisted variables that I had when installing the previous version (Just for the uninstall).
Thanks.
Re: Upgrade with custom uninstallation logic
Posted: Wed Apr 04, 2012 10:43 am
by FrancescoT
Dear Louis,
Let me try to verify if I understand what you want to do.
- You Install your first version of your app, say ver 1.0.
- The You Install a successive version of your app, say ver 2.0.
In your script before that "Uninstall 1.0 version" section is executed, do you want to retrive the installation path used by 1.0 version and use this, as TARGETDIR for ver 2.0 installation.
Correct?
Do you want to run ver 2.0 install in silent mode?
Regards
Re: Upgrade with custom uninstallation logic
Posted: Thu Apr 05, 2012 6:39 am
by lpperras
What I want is simple, when I build a new setup, and deploy it on another machine that has a previous version, I want to uninstall the previous version with my custom logic from my previous setup. I stated what is written in your documentation, I just want to know where is the <setup.exe> file you mentiojn in that documentation? How do I access this file and know the full path to call Run Command on it like it is documented in your documentation. By default, it calls the uninstall of the msi, but that does not call my custom logic. The flag to upgrade is true, uninstall the msi, but then if I created some stuff after the install, and have some code in my uninstall to clean that up, it won't be called with uninstall msi.
Thanks,
Louis
Re: Upgrade with custom uninstallation logic
Posted: Thu Apr 05, 2012 10:21 am
by FrancescoT
Dear Louis,
you can find this info under the the REG KEY:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT CODE GUI}
if the installation as been executed per user the key "InstallSource" is used as for example:
"C:\Users\USER NAME\AppData\Local\Temp\mia1\"
if the installation as been executed per machine the key "UninstallString" is used as for example:
C:\ProgramData\{PRODUCT CODE GUI}\Setup.exe
Is this what you are searching?
Regards
Re: Upgrade with custom uninstallation logic
Posted: Thu Apr 05, 2012 12:06 pm
by lpperras
I guess this is what I need yes, unless you tell me otherwise. In your documentation, for the flag NEEDSUPGRADE, it states:
If your InstallAware setup has custom uninstallation logic, try uninstalling it using the Run Program command and an uninstallation command line, assuring that your custom logic executes.
I guess that what I need to do is locate the previous setup.exe in the registry with the key you provided me and call it to do a silent uninstall? Am I right? Is there anything returned from the .exe in the Run Command if the uninstall fails?
EDIT: I looked at this in the registry, and even though the registry InstallSource refers to a directory C:\Users\USER NAME\AppData\Local\Temp\mia1\, the directory does not exist until I start the uninstall from Programs and Features or Add/Remove Programs. As soon as I start to uninstall, the directory is created, but how can I uninstall my previous version if the .exe does not exist at this location? Can I get it from somewhere else?
Thanks,
Louis
Re: Upgrade with custom uninstallation logic
Posted: Fri Apr 06, 2012 9:24 am
by FrancescoT
Dear Louis,
First of all excuse me .... but with copy and paste I have done some mistakes.
When the install is executed per User the path will be always:
"C:\Users\<USER NAME>\AppData\Local\{REVISION CODE GUI}"
if the installation has been executed per machine the value of the key "UninstallString" in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT CODE GUI}
will be present and it could be as for example: C:\ProgramData\{REVISION CODE GUI}\Setup.exe
If the Installation has been executed per user the value of the key "UninstallString" in:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\{PRODUCT CODE GUI}
will be present and it could be as for example: C:\Users\<USER NAME>\AppData\Local\{REVISION CODE GUI}\Setup.exe
So checking the registry for the precence of "UninstallString", you should be able to know if installed per User or Machine.
THEN
If your InstallAware setup has custom uninstallation logic, try uninstalling it using the Run Program command and an uninstallation command line, assuring that your custom logic executes.
This means that you can use custom command line parameters as you need.
For example:
you can use command line parameters to unistall:
"C:\Users\<USER NAME>\AppData\Local\{REVISION CODE GUI}\Setup.exe" MODIFY=FALSE REMOVE=TRUE UNINSTALL=YES
you can use custom command line parameters plus "custom parameter" to unistall:
"C:\Users\<USER NAME>\AppData\Local\{REVISION CODE GUI}\Setup.exe" MODIFY=FALSE REMOVE=TRUE UNINSTALL=YES MYPARAM=DOIT
you can use command line parameters plus "custom parameter" to unistall in silent mode:
"C:\Users\<USER NAME>\AppData\Local\{REVISION CODE GUI}\Setup.exe" /s MODIFY=FALSE REMOVE=TRUE UNINSTALL=YES MYPARAM=DOIT
When using Custom Command Line as in the above example, you will use the value of VARIABLE "MYPARAM" to do somenthing, as you want with your uninstall logic. But you do not have to necessarily to call it in silent mode ... it is up to you.
Is there anything returned from the .exe in the Run Command if the uninstall fails?
If am not wrong it returns 0 (zero) or SUCCESS / COMPLETE when completed ... but anyway you can easly debug the code to see what it is the correct value.
Hope that helps you.
Regards
Re: Upgrade with custom uninstallation logic
Posted: Tue Apr 10, 2012 11:59 am
by lpperras
Thank you again for replying. I juste tried what you mention with version 12 of InstallAware and I did not have the UninstallString even with the ALLUSERS variable set to true. I looked at the ENGINECACHE variable in Debug to know what it contains, and found out that it was in fact pointing to C:\ProgramData\{Revision Code GUID} instead of the Product Code GUID you mentioned. The command line worked just fine in that folder, but how can I know what is the revision code of the product installed if I don'T have the UninstallString key. The product code key exists but I don't have the UninstallString. I know the ALLUSERS worked because I can find the setup.exe file in ProgramData like mentioned.
Also, how do I know if a reboot is required? Is it a different return code returned by the .exe?
EDIT: I just found out where the UninstallString key you refer to was stored. We install our setup in 64bit and the UninstallString is the only key stored in HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{Product Code GUID}. The other keys are not in the Wow6432node. Is this a normal behaviour or is this a bug in installaware? I can probably use Read Registry before setting my installer in 64bit mode to check that key, but I want to make sure this is the correct behaviour.
Any help would be appreciated.
Thanks,
Louis
Re: Upgrade with custom uninstallation logic
Posted: Wed Apr 11, 2012 12:37 pm
by FrancescoT
Dear Louis,
please have a look at my previous post ... I have corrected some errors due wrong COPY & PAST

.
So you should be able to have what you are serching for.
Also, how do I know if a reboot is required? Is it a different return code returned by the .exe?
Yes should be different ... I do not remember the value returned ... but of course it is. Just check it via debug, you should be able to do easly.
EDIT: I just found out where the UninstallString key you refer to was stored. We install our setup in 64bit and the UninstallString is the only key stored in HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{Product Code GUID}. The other keys are not in the Wow6432node. Is this a normal behaviour or is this a bug in installaware? I can probably use Read Registry before setting my installer in 64bit mode to check that key, but I want to make sure this is the correct behaviour.
Ok you are using a 64 bit target OS, but ... is your application installed 64 bit also?
If you install a 32 bit app on a target 64 bit OS, all the operations to "HKLM\SOFTWARE" will be redirected by the OS to "HKLM\SOFTWARE\Wow6432Node".
The same happens with your 32 bit application on a target 64 bit OS, all the operations to "HKLM\SOFTWARE" will be redirected by the OS to "HKLM\SOFTWARE\Wow6432Node".
Only native 64 bit application can have access directly to "HKLM\SOFTWARE" in this case, you should use the "Set x64 - Native 64 bit Windows" with your InstallAware project script code.
Regards