Wednesday, August 5, 2009

MSI and Run As Administrator

Some MSI programs require elevated privilege to run and its always cumbersome to run it through runas.

In Windows Vista/7, the shell integration (right click) of an Exe will contain a Run As Administrator function like below.

image

But for MSI files, there’s no such context! Of course, there are otherways but this right click thingy is what i want, its quick and easy.

image

MSI files do not have the Run as administrator shell integration.

How to make that Run as administrator come integrated with MSI and or other executables (e.g. VBS, MSI, BAT). Try this.

For MSIs

Start notepad.exe and paste the below text exactly

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Msi.Package\shell\runas]

[HKEY_CLASSES_ROOT\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

Don’t worry about text residing to a point you can see, just copy and paste the whole table. When you paste the above, it MUST look something like this:

image

If it doesn’t stop right there, something is not right. Try again.

Now save this document as shell_enable_msi.reg (filename doesnt matter, just as long the extension is .reg. Make sure the registryicon appears after you do that like below.

image

This means its associated with the registry tool. Now double click the icon and UAC should complain, but just say yes on both counts!

image

image

Once exported, you should see this;

image

Now try again with that MSI extension. Voila!

image

And there you go.

Anyway, in case you’re curious what all those jargon you pasted into your registry its nothing much, its actually…

image

Post a Comment