Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 23 down vote accepted

.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>\""
                                      ^^                               ^^
share|improve this answer
    
related: serverfault.com/questions/19341/… –  hyperslug Aug 13 '09 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). –  Tim Pietzcker Aug 13 '09 at 9:32
    
@Tim: Ok, thanks, updated the answer. –  fretje Aug 13 '09 at 9:36
    
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 '10 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 '11 at 7:11

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

share|improve this answer

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"

share|improve this answer

protected by studiohack May 3 '11 at 10:11

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.