Hello,
Could you please explain me how to properly set a checkbox or pushbutton to relaunch the same installer (A) in ExitDialog?
Because in that guide I saw the example is notepad.exe which is a system app, so it is indeed possible to execute it, but how do I do that with my app?
Sure thing!
First of all, let's talk about the steps required to achieve this:
- we will need to store the path of the MSI/EXE somewhere. I'd say the best place to do so is in the registries.
- we will then need a custom action that will read the path from the registry and then launch our MSI/EXE one more time.
OBS: As I have mentioned earlier, this might not work due to the fact that the software is already installed on the machine. This way, the setup will be launched in
Maintenance mode.
Toi avoid this, you can go to
"Product Details" page and uncheck the
"Register product with Windows Installer" option.
However, if this option is not checked you cannot remove, repair or reinstall the application by using the Control Panel, the Windows Installer command-line options or the Windows Installer application programming interface (API).
Here would be the steps to help you achieve what you need:
1. please go to
"Registry" page and create a new value, as it follows:
- registry.png (39.18KiB)Viewed 2276 times
2. in
"Custom Actions" page, create a
custom action without sequence that retrieves the value of the registry (the path of the MSI) and then launches the MSI.
A PowerShell script that does this may look as it follows:
Code: Select all
$path = Get-ItemPropertyValue -path 'HKLM:\Software\Your Company\zzz' -name SourceOfMsi
Start-Process msiexec.exe -ArgumentList "/i $path"
3. schedule the custom action as a
"Published Event" on the
"Finish" button of the
"ExitDlg" dialog
- publishedevent.png (222.6KiB)Viewed 2276 times
Important: One really important thing we have to consider here is the registry redirection. The above custom action is indended to work in the following scenario:
-
32-bit setup installed on a 64-bit machine
As you may already know, 32-bit programs will redirect, on a 64-bit machine, the registry and the files to special locations:
- in case of files, that would be the
"Program Files (x86)" folder
- in case of registry, that would be the
"WOW6432Node"
- wow6432node.png (95.97KiB)Viewed 2276 times
With that being said, depending on your scenario, you might need to have two custom actions. Depending on how you configure the custom action (PowerShell), you can choose to launch the 32-bit or the 64-bit PowerShell platform.
Best regards,
Catalin