Add Run as administrator context menu item to MSI files

It is useful to have an open to run Windows Installer files (*.msi) as administrator. There are some desktop apps which have issues installing correctly when UAC is enabled. Also, when you install an MSI package in a limited user account, it requires an elevated command prompt and a number of additional actions. To avoid this, you can add a context menu command for MSI files to the File Explorer app which will allow you to run the selected MSI file as administrator. Here is how.

Advertisment


This can be done with a simple Registry tweak. Follow the instructions below.

  1. Open Registry Editor.
  2. Go to the following Registry key:
    HKEY_CLASSES_ROOT\Msi.Package\shell

    Tip: You can access any desired Registry key with one click.
    If you have no such Registry key, then just create it.

  3. Create here a new subkey named "runas". You will get
    HKEY_CLASSES_ROOT\Msi.Package\shell\runas
  4. Under the runas subkey, create a new string value named HasLUAShield. Don't set its value data, leave it empty. This value is only required to add the UAC icon to the context menu item you are creating. You should get it as follows:Windows 10 add run as admininstrator for MSI
  5. Under the runas subkey, create a new subkey called "command". You will get the following path:
    HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command

    Set the default parameter of the command subkey to the following text:

    C:\Windows\System32\msiexec.exe /i \"%1\" %*

    You will get something like this:Windows 10 add msi file run as admininstrator

Now right click any *.msi file to test the context menu item:Windows 10 msi file run as admininstrator test1

A UAC prompt will appear.Windows 10 msi file run as admininstrator test2

You are done. To undo this change, delete the mentioned "runas" subkey.

The same can be done using Winaero Tweaker. Go to Context Menu -> Run as Administrator:
Winaero Tweaker runas context menuUse this option to avoid Registry editing.
Also, I made ready-to-use Registry files, so you can avoid manual Registry editing. An undo file is also included.

Download Registry files

That's it.

Advertisment

Leave a Reply

Your email address will not be published. Required fields are marked *