/bin/tim

June 11, 2007

Elevating MSI

Filed under: Dev, General, Microsoft, Tech, Windows XP — tim CARMICHAEL @ 9:09 pm

One of the big (supposed) benefits of Windows Installer technology is the capability to install applications easily without admin privileges because MSI would elevate privileges to facilitate the installation process.  Turns out this doesn’t work so well and when logged in as a regular user the MSI will fail to install and you will need to (rather inconveniently) log in as administrator and start the install again.

Now if the MSI ships with a companion setup bootstrap program then you can right click it and choose ‘Run AS’ and then provide admin credentials interactively without logging out and everything is sunny again (except any user specific items get created in the Administrators profile, but you cant have everything).

However, right clicking an MSI does not provide a Run As option … why?  Indeed, why oh why…. 

There is a solution though, turns out its not that it can’t be done its just that Microsoft chose not to make that option available by default.  Just add a registry key and you will get Run As for your MSI files.  Copy the following into a .REG file and then double click the REG file you created and import these settings into your registry. You will have to do that as Administrator.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Msi.Package\shell\RunAs\Command]
@=”msiexec /i \”%1\”"

Happy Running As!

Blog at WordPress.com.