How to Deploy User Data in MSI with Self-Healing and Active Setup
Back

Deployment of User Data via MSI with Self-Healing and Active Setup

In software deployment on Windows systems, ensuring that user-related resources are correctly configured and maintained is crucial for a seamless user experience. Deploying user data within Windows Installer can often be challenging, fraught with potential pitfalls and complications. Two key mechanisms employed in this endeavour are Self-Healing and Active Setup, integrated within MSI packages.

In this article, we’ll explore the intricacies of these mechanisms and how they facilitate the deployment and maintenance of user-specific resources.

Contents

Why Is There an Issue Installing User Data in Windows Installer?

What is Self-Healing?

How Does Self-Healing Work?

How to Implement the Self-Healing Mechanism?

How Does It All Work During Deployment?

What is Active Setup?

Integration of Active Setup with PACE Suite

Why Is There an Issue Installing User Data in Windows Installer?

Due to the nature of Windows Installer, installing user data poses unique challenges. Unlike system-wide resources, user-specific settings and files must be deployed to accommodate multiple user profiles on a single system. Traditional installation methods may struggle to handle this complexity, leading to inconsistencies and errors during deployment.

What is Self-Healing?

Self-Healing is a feature of Windows Installer technology that ensures the integrity and availability of installed applications. It automatically detects and repairs missing or corrupted components, restoring the application to a functional state. This mechanism is particularly beneficial for user-related resources, as it guarantees that necessary components are always available, irrespective of user actions or system changes.

How Does Self-Healing Work?

Self-healing can work in three ways: resource key paths, detection and repair, and reinstallation of components. Let’s have a closer look at each one of them.

1. Resource Key Paths: Within an MSI package, specific files, registry entries, ODBC Data, or directories are designated as key paths. These key paths serve as reference points for Windows Installer to verify the presence and integrity of installed components.

2. Detection and Repair: When a user attempts to launch an application installed via MSI, Windows Installer performs a quick check to ensure that all key paths are intact. If any key path is missing or damaged, Windows Installer initiates a self-healing process.

3. Reinstallation of Components: During repair, Windows Installer reinstalls the missing or damaged components using the original installation source. This process restores the application to its functional state, seamlessly addressing any issues encountered.

How to Implement the Self-Healing Mechanism?

Let’s consider the implementation of the self-healing mechanism using Notepad++ as an example and using PACE Suite , one of the most user-friendly application packaging tools.

The program generates the following configuration files:

%AppData%\Notepad++\contextMenu.xml

%AppData%\Notepad++\userDefineLangs\markdown._preinstalled.udl.xml

%AppData%\Notepad++\userDefineLangs\markdown._preinstalled_DM.udl.xml

%AppData%\Notepad++\tabContextMenu_example.xml

%AppData%\Notepad++\toolbarIcons.xml

To ensure the functionality of plugins and user-defined settings, they should be installed in the user profile. To achieve this, follow these steps:

1. Identify the specific user resources required for the program functionality.

2. Replicate the corresponding directory structure for the user profile: %AppData%\Notepad++, %AppData%\Notepad++\userDefinedLangs, etc.

User related notepad

3. Create a machine folder containing the necessary files and import it into the installation (in our case, the folder containing configuration files would be %ProgramFiles%\Notepad++\UserData) .

User related package designer

4. Create a CurrentUser component with unique key paths such as Software\[Manufacturer]\[ProductName]\[ProductVersion]\[ProductLanguage] and import the user registry settings if available.

User related MSI table properties

5. Feel in the DuplicateFile table — configuration files should be copied to the user profile during the self-repair mechanism.

User related Table Editor

How Does It All Work During Deployment?

Let’s look closely at what happens under the hood during deployment from a system account or in a multi-user environment.

The program is installed, and the user can launch the program using an advertised shortcut, file extension, or context menu. Only in these cases, without a key to the CurrentUser component, will the self-recovery mechanism be triggered. The following entry in the Windows Logs\Application evidences this:

User related notepad 64

Detection of the product ‘{06C33CB0-1D41-4128-84AB-232E8F0670E4}’, feature ‘NotepadPlusPlus’, component ‘{734CB40C-B729-4669-9871-E5B36CE95840}’ failed. The resource ‘HKEY_CURRENT_USER(64)\Software\Notepad++ Team\Notepad++ (64-bit x64)\8.6.4\1033\{06C33CB0-1D41-4128-84AB-232E8F0670E4}’ does not exist.

Windows Installer detected a corrupted component and restored its keypath and all associated resources, namely redistributing the files we recorded to the DuplicateFile Table.

Entries like:

Detection of the product ‘{06C33CB0-1D41-4128-84AB-232E8F0670E4}’, feature ‘NotepadPlusPlus’ failed during request for component ‘{761EA198-EFFD-4044-B0A2-B00FA1B85AE9}’ indicate which entry point triggered the self-recovery mechanism (in our case, it’s the advertised shortcut OR the context menu library NppShell.dll).

Upon successful completion, the following entries will appear in the log:

Product: Notepad++ (64-bit x64) — Configuration completed successfully.

Windows Installer reconfigured the product. Product Name: Notepad++ (64-bit x64). Product Version: 8.6.4. Product Language: 1033. Manufacturer: Notepad++ Team. Reconfiguration success or error status: 0.

Important Note: Always use a unique keypath for components intended to distribute user data. For large packages, it makes sense to move the CurrentUser component into a separate parent feature to reduce the time spent checking all keypaths.

Despite all the advantages, Self-healing can only be utilized in cases where entry points such as advertised shortcuts, file associations (filled through corresponding advertised tables), and context menu libraries exist. However, if the program lacks the above-mentioned entry points, classic shortcuts, or file associations, this method does not function.

What is Active Setup?

Active Setup is another powerful mechanism for deploying user-specific settings or configurations on Windows systems. Unlike Self-Healing, which focuses on repairing application components, Active Setup primarily deals with initializing user-specific configurations upon user logon.

Key Components of Active Setup:

1. Registry Entries: Active Setup configurations are defined through entries in the Windows Registry, specifically under the `HKCU|HKLM\Software\Microsoft\Active Setup\Installed Components\` key.

2. Version Control: Each Active Setup component includes version information. Upon user logon, Windows compares the version stored in the machine registry with the version specified in the user registry. If the registry version is newer, Active Setup triggers the setup process for that component.

3. Setup Actions: Active Setup executes specified commands or scripts to configure user-specific settings. These actions may involve copying files, creating registry entries, or performing other setup tasks tailored to individual user profiles.

Integration of Active Setup with PACE Suite

MSI packages often leverage Active Setup to ensure that user-specific configurations are applied consistently across different systems. By incorporating Active Setup into the installation process, MSI packages can initialize user-related resources upon user logon, providing a personalized and seamless user experience.

In PACE Suite, adding Active Setup into the MSI package is implemented upon detection of user-related data. The designated configurations will be enforced during the build of the MSI package.

Navigate to the Package tab and verify that the MSI package format is selected.

User related active setup integration

To adjust the profile settings, click on the Edit button adjacent to the MSI settings profile field.

User related active setup edit

Proceed to the Per-User data tab and check the box for the “Add Active Setup to propagate per-user data” option. Then, save the changes.

User related activesetup add
User related activesetup final

Wrapping Up

Deploying user resources within Windows Installer presents unique challenges that require careful consideration and strategic planning. By leveraging features such as Self-Healing and Active Setup, organizations can streamline the deployment process and enhance the user experience.

While each method offers distinct advantages and disadvantages, understanding their functionality is essential for achieving reliable and efficient deployment outcomes. As technology evolves, mastering these techniques will be instrumental in navigating the complexities of modern software deployment within Windows environments.

Blog