20

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?

kinokijuf
  • 8,364

3 Answers3

26

.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>\""
                                      ^^                               ^^
hakre
  • 2,431
fretje
  • 10,732
8

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"

Sam
  • 271
0

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

Richard
  • 9,172