How does installer service execute an MSI?
There are three phases of the setup:
In this phase, Windows Installer receives instructions, from an user or an application, to install or uninstall features of a product. The requests cause the execution of sequences of actions, which query the installation database to build a script describing the execution phase in detail.
In this phase, the script built in the previous phase is executed in the context of the privileged Windows Installer service. The script has to be executed by a privileged service because of the etherogeneity of the scenarios in which a setup operation is initiated - for example, it's necessary to serve on-demand installation requests from non-privileged users.
In case any script action fails, or the operation is cancelled by the user, all the actions performed until that point are rolled back, restoring the system to its original state.