Installing an MSI with elevated privileges

Article:HOWTO1927  |  Created: 2005-09-12  |  Updated: 2006-06-08  |  Article URL http://www.symantec.com/docs/HOWTO1927
Article Type
How To



Question
How can I install my .MSI in an elevated privilege state?

Answer

A method used to allow regular users to install an .MSI on their computer is to use the AlwaysInstallElevated keys. This method has you adds two registry keys to the current user and local computer hives. 

This change has to be made before the installation of the .MSI. For example, if you want a typical user to install an .MSI based package on a secured computer, an Administrator needs to add the two registry keys before the regular user installs the .MSI.

To install a package with elevated (system) privileges, always set the AlwaysInstallElevated value to "1" under both of the following registry keys:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer

AlwaysInstallElevated (Per-Machine) REG_DWORD: If this value is set to "1" and the corresponding user value is also set, the installer always installs with elevated privileges. Otherwise, the installer uses elevated privileges to install managed applications and uses the current user's privilege level for non-managed applications.

In addition to the standard top-level registry keys, Windows Installer Editor provides a special registry key named HKEY_USER_SELECTABLE. Depending on the operating system, during installation a user can choose to install an application for the current user only or for all the users of the computer. Registry changes under this key are made to HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, based on the user's choice during installation.

Additional information can be found in Windows Installer SDK Help under the term "AlwaysInstallElevated". Check both the per-user and per-computer examples.

Related Links
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/alwaysinstallelevated.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/how_do_i_install_a_package_with_elevated_privileges_as_a_non_admin.asp


Legacy ID



1874


Article URL http://www.symantec.com/docs/HOWTO1927


Terms of use for this information are found in Legal Notices