Tuesday, May 29, 2012

Install as another (administrative) user on Windows XP

Gotta love it when you get an install package as an .exe file - right click and "Run As" to install it as an admin account. All good. But when you get an .msi do you really have to log out, then log in as an administrative user, just to install it? I've always known there must be a better way to do it, but it finally irritated me enough to find out. The trick is to use the runas command:

C:\Documents and Settings\myUser>runas /user:domain\admin-account "msiexec /i \"C:\Documents and Settings\myUser\My Documents\Downloads\someInstaller.msi\""

Some gotchas:
  • you must include the whole command you're passing to runas in quotes
  • if the path to the MSI file has spaces in it, you must put it in quotes
  • you can't nest quotes, so you'll have to use a backslash to escape the inner set of quotes
For the record, some bright sparks have suggested some simple reg hacking to create an "Install as" menu item in the right-click context menu. Nice idea, and it appeals to my sense of order and neatness. I'll have to try that next time it irritates me enough.

1 comment:

  1. A slightly quicker method that I normally use is to start a command prompt as an admin user via runas, and then just run the .msi from the command prompt.