Dan
Posts: 4484
Joined: Wed Apr 24, 2013 3:51 pm

Configure custom action that launches a file installed by the setup

Thu Dec 17, 2020 2:20 pm

Hello,

There are scenarios when the installer needs to launch some files installed on the machine or to execute scripts that reffers to installed files.

The settings are different for install and for uninstall.

Configure the custom action that will be executed during installation

When the custom action reference any file installed by the setup, the custom action needs to be executed after the files are copied on the target machine.

That means the custom action should be placed after the Add Resources action group. Also, the custom action needs to be executed when the system is being modified (deferred). This is happening because the files are coppied on the machine during the deferred phase. You can read more about the deferred custom actions in this article.

If the execution requires admin privileges then the Run under the LocalSystem account with full privileges (no impersonation) option needs to be selected. Most of the time this option should be enabled.

Always disable the Uninstall execution time.

Here's a preview of how the custom action should be configured:

ConfigureInstallCA.PNG
ConfigureInstallCA.PNG (92.68 KiB) Viewed 6680 times


Configuring the custom action that is executed during the uninstall

When the custom action reference any file installed by the setup, the custom action needs to be executed while the files are still available on the target machine. On uninstall, the files are removed from the machine during the Remove Resources action group.

So, the custom action needs to be executed before Remove Resources action group. Also the when the system is being modified (deferred) option is required in order to be able to provide admin privileges to the custom action.This is happening because the Run under the LocalSystem account with full privileges (no impersonation) option is only available for deferred actions, not for immediate ones.

So, if the execution requires admin privileges then the Run under the LocalSystem account with full privileges (no impersonation) option needs to be selected.

Always disable the Install and Maintenance execution time. Otherwise, the installation will fail if we keep install enabled as the files are not available for execution. This is also the most common case for custom action misconfiguration.

Here's a preview of how the custom action should be configured:

ConfigureUninstallCA.PNG
ConfigureUninstallCA.PNG (91.65 KiB) Viewed 6680 times

Happy packaging!
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Sample Projects”