19

I'm usually logged in as a normal user on my Windows XP box. Sometimes, when I want to install a software update, I don't want to log off and log on again as admin, but I right-click the installer exe and choose "Run as..." to run it from my admin account. However, this option only seems to exist for exe files, not for msi files.

Is there a way to make msi files run under a different account? Or is that not advisable for some reason?

1
  • Just launch the install of the MSI file from an elevated command prompt (right click cmd.exe and select "run as administrator"). Install with a command line something like this: msiexec.exe /I "MyFile.msi" /QN /L*V "C:\msilog.log" (update paths as appropriate). Runas should work OK, I just find an elevated command prompt easier. Sep 7, 2017 at 21:14

3 Answers 3

25

.msi files can be executed with msiexec.exe, so in combination with the runas command, you could accomplish what your want:

runas /user:administrator "msiexec /i <path and filename of your msi>"

As a full-path to the file is recommended, it might need quotes around it and you need to escape them then with a backslash \:

runas /user:administrator "msiexec /i \"<path and filename of your msi>\""
                                      ^^                               ^^
5
  • related: serverfault.com/questions/19341/…
    – hyperslug
    Aug 13, 2009 at 9:11
  • Ah thanks, hadn't checked serverfault. @fretje: Thanks, however I first got an error message that msiexec couldn't open the msi file. It appears that you need to specify the entire path to the msi file. The current directory that runas is run from doesn't get passed to the command that is being run, in this case msiexec (which makes sense). Aug 13, 2009 at 9:32
  • It looks like you should also be able to just use msiexec /a package.msi -- see the msiexec page on TechNet (which says it's for Server 2003, but appears identical to the content of the corresponding page in the XP help system).
    – SamB
    Dec 10, 2010 at 22:39
  • @SamB: Administrative installation merely means installing an image of an installsource local on the network from where others then can install the application on their machine (in stead of using a cd-rom). The user can then choose to run-from-source when he installs and the installer uses most of the product's files directly from the network. So this is not what the OP means (run as administrator).
    – fretje
    May 19, 2011 at 7:11
  • @fretje: Oh... that's confusing!
    – SamB
    May 19, 2011 at 15:24
6

You can always open a command prompt as an administrator (either right-click runas or start->run->runas /user:administrator cmd), change to the directory where your MSI exists, and execute msiexec /i product.msi

Or add this to your register: HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command Values: Install &as... HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command Value: msiexec /i "%1"

0

Take a look at runas from the command line. You can launch anything under as specified account.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .