Adding a “Run As…” command to .MSI and .MSP files
Finally I feel safe to share this trick: Adding a “Run As…” command to .MSI files and .MSP files in Windows XP and Windows Server 2003.
In my earlier post, I discussed Run As… command which makes using limited user accounts more convenient. However, if you right-click a file with .MSI or .MSP extension (Windows Installer) you will find no “Run As…” commands. So, you may encounter difficulties installing or patching using alternative credentials under a limited user account. In fact, you may know no other options but logging out and into another user account.
This post does not apply to Windows Vista and later, which use User Account Control in conjunction with Windows Installer service.
To add a “Run As…” command to .MSI and .MSP files on your computer:
- Log on to your computer using a user account with administrative privileges.
- Copy and paste the following lines of code into an empty text file. (Needless to say, you can use Notepad to create text files.)
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Classes\Msi.Package\shell\RunAs] @="R&un As..." [HKEY_CURRENT_USER\Software\Classes\Msi.Package\shell\RunAs\command] @=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\ 00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,6d,00,\ 73,00,69,00,65,00,78,00,65,00,63,00,2e,00,65,00,78,00,65,00,22,00,20,00,2f,\ 00,69,00,20,00,22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00 [HKEY_CURRENT_USER\Software\Classes\Msi.Patch\shell\RunAs] @="R&un As..." [HKEY_CURRENT_USER\Software\Classes\Msi.Patch\shell\RunAs\command] @=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\ 00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,6d,00,\ 73,00,69,00,65,00,78,00,65,00,63,00,2e,00,65,00,78,00,65,00,22,00,20,00,2f,\ 00,70,00,20,00,22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00
- Save the file with .reg extension. Ensure that the file is being saved in Unicode format. To do so in Notepad, click on File menu and select Save As… command. Then, from the Encoding drop-down list, choose Unicode. In the File name field, type a quotation mark (“) , followed by a name, follow by .reg, followed by another quotation mark (“). Now press Save button. This should yield a Registration Entries file.
- Double-click the file to have its contents merged with your Windows Registry. Needless to say, Windows Registry will first ask you for confirmation. Confirm the operation.
- Log out and back on.
From now on, you will have a “Run As…” command for your .MSI and .MSP files. You can now install software without logging out of your Limited User Account.
Technically speaking, all you need to do is to duplicate the Open verbs of .MSI and .MSP files with a new RunAs verb. Windows Explorer (Windows Shell) executes the command of RunAs verb with credentials which you supply via a Run As dialog box. You can do it either using the method I explained, or manually using Folder Options (File Types tab) or Registry Editor.
Edit (2009-05-19): Updated information on creating a proper .reg file.
Posted on 27 October 2007, in Windows Administration and tagged .msi, .msp, Notepad, Registry, Run As, User Account Control, Windows Installer, Windows Server 2003, Windows Vista, Windows XP. Bookmark the permalink. 3 Comments.