Custom Actions
Custom Actions view shows all Custom Actions that are in the MSI.
Custom Actions enables to add custom scripts or actions that can be launched during installation and uninstallations and allows expand you MSI functionality beyond built in MSI database functions.
Master Packager enables to work with two sets of Custom Actions:
- Custom Actions - users can build their own sets of custom actions
- Predefined Actions - created by Master Packager Team empower packagers to use standardize actions for functionality that cannot be performed using MSI standard tables.
Custom Actions
-
Name
Sets Custom Action name. It should be unique and descriptive to make it easy to identify the action’s purpose. -
Type
Sets Custom Action type. There are multiple Custom Action types that can be used for different cases and automation.- JScript:
- In Binary Table
- In File Table
- In CustomAction Table
- In path of Property
- VBScript:
- In Binary Table
- In File Table
- In CustomAction Table
- In path of Property
- DLL:
- In Binary Table
- In File Table
- EXE:
- In Binary Table
- In File Table
- On Target PC
- In path of Property
- MSI Internal:
- Display Error Message
- Set Directory
- Set Property
- JScript:
-
Execution Options
Sets Custom Action type. There are multiple Custom Action types that can be used for different cases and automation:- Immediate
Runs instantly when the installer processes the action. - Deferred User
Runs later during the install’s execution phase under the user’s context. - Rollback User
Runs if the install is rolled back, under the user’s context. - Commit User
Runs at the end of installation if everything succeeded, under the user’s context. - Deferred System
Runs later during the install’s execution phase under the system context (elevated privileges). - Rollback System
Runs during rollback under the system context. - Commit System
Runs at the end of installation if everything succeeded, under the system context. - Deferred TSAware
Runs as a Terminal Server–aware action during the execution phase. - Rollback TSAware
Runs during rollback as a Terminal Server–aware action. - Commit TSAware
Runs during the commit phase as a Terminal Server–aware action.
- Immediate
-
Return Processing
Defines how the installer handles the result of the custom action:- Synchronous, waits for exit code
Runs the action and waits for it to finish. Checks the exit code for success or failure. - Synchronous, ignore exit code
Runs the action and waits for it to finish but ignores whether it succeeds or fails. - Asynchronous, waits for exit code
Starts the action, continues other processing, and eventually waits for completion and checks the result. - Asynchronous, ignore exit code
Starts the action and moves on immediately without waiting or checking the result.
- Synchronous, waits for exit code
Tip: For critical tasks, use synchronous options to ensure proper
error handling.
- Scheduling Options
Determines where in the install sequence the action runs:- Always
Executes every time the action is encountered. - Execute first time
Runs only during the initial install, not during repairs or reinstalls. - Execute once per process
Runs only once, even if referenced multiple times in the install sequence. - Execute only after UI sequence
Delays execution until after the User Interface sequence has completed.
- Always
Note: Proper scheduling ensures custom actions run in the correct context and avoids unintended repeated execution.
Predefined Actions
Created by Master Packager Team empower packagers to use standardize actions for functionality that cannot be performed using MSI standard tables.
-
Apply HKCU registries to all users
Ensure HKCU registry keys are applied for every user on the system. -
Remove HKCU registries from all users
Delete specified HKCU registry keys from all user profiles. -
Copy to User Profile
Copy files or folders into user profile locations for all users. -
Delete from User Profile
Remove files or folders from user profile locations across all users. -
Run PowerShell Script
Execute custom PowerShell scripts during installation or uninstallation. -
Replace string in text file
Find and replace text within files as part of package installation. -
Add firewall exception
Automatically add rules to the Windows Firewall to allow specific applications or ports. -
Append or prepend text line in file
Insert a line of text at the start or end of a text file. -
Register DLL
Register a DLL file in the system, making its functions available to other applications. -
Unregister DLL
Remove the registration of a DLL file, unregistering its functions from the system. -
Install MSIX Package
Install an MSIX package as part of the deployment process. -
Uninstall MSIX Package
Uninstall an MSIX package during uninstallation or upgrade.