Calling a Kill-Process Custom Action

InstallShield 2015

Project: This information applies to the following project types:

Basic MSI
InstallScript MSI

The kill-process type of custom action terminates one or more processes at run time. The following procedure describes how to include and configure this type of custom action in your project.

To add a kill-process custom action to your project:

1. In the View List under Behavior and Logic, click Custom Actions and Sequences.
2. Right-click the Custom Actions explorer and then click New Kill Process. InstallShield adds a kill-process custom action with a default name.
3. Enter a new name, or right-click it later and click Rename to assign it a new name. Use a name that helps you distinguish this custom action from other actions in your project.
4. In the right-pane, configure the action’s settings:
a. In the In-Script Execution setting, select the iteration of the sequence that should trigger the action. For details about each option, see In-Script Execution.
b. Use the settings in the Sequences area to schedule the custom action at the point where you want the process to be terminated. As an alternative, you can drag the custom action from the Custom Actions explorer to the appropriate node under the Sequences explorer.
c. In the Function Name setting, select the appropriate function:
KillProcess—If you selected one of the immediate options in the In-Script Execution setting and you want to kill a process that has a particular name, select this option.
KillProcessByID—If you selected one of the immediate options in the In-Script Execution setting and you want to kill a process that has a particular process identifier (PID), select this option.
KillProcessDeferred—If you selected one of the deferred, commit, or rollback options in the In-Script Execution setting and you want to kill a process that has a particular name, select this option.
KillProcessByIDDeferred—If you selected one of the deferred, commit, or rollback options in the In-Script Execution setting and you want to kill a process that has a particular PID, select this option.
d. Configure any of the action’s other settings as needed.
5. In the View List under Behavior and Logic, click Property Manager.
6. Create and set a new property that identifies one or more processes that you want to terminate:
a. Click the New Property button. InstallShield adds a new row at the bottom of the view.
b. In the Name column, enter a name for the new property. The name that you enter depends on what you selected for the In-Script Execution setting:
If you selected one of the immediate options in the In-Script Execution setting, enter the following name:

ISTerminateProcesses

If you selected one of the deferred, commit, or rollback options in the In-Script Execution setting, enter the same name that you entered for the name of the kill-process custom action, as described in step 3. The spelling and capitalization must match exactly.
c. In the Value column, enter the executable file names or PIDs of the processes that you want to terminate.

Note that if you selected KillProcess or KillProcessDeferred in the Function Name setting, enter the executable file names of the processes. If you selected KillProcessByID or KillProcessByIDDeferred, enter the PIDs.

If you want to terminate more than one process, use a semicolon (;) to separate each file name or ID. For example, to terminate processes that have names such as myfile1.exe and myfile2.exe, enter the following:

myfile1.exe;myfile2.exe

To terminate processes that have PIDs of 3740 and 4196, enter the following:

3740;4196

See Also