Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Run MSI in administrator mode by double clicking?


5 replies to this topic

goyalpk@yahoo.com

goyalpk@yahoo.com
  • Full Members
  • 3 posts

Posted 26 June 2011 - 01:26

Hi there,
How can I run MSI in administrator mode automatically by double clicking it (not though command prompt)?

Can I do something in ISM file so that whenever I run MSI by double clicking it then it runs it administrator mode automatically?

I have one MSI which runs in administrator mode when I double click it but this other MSI does not run in administrator mode when I double click it (through command prompt it runs in administrator mode).

Customers might run this MSI by double clicking it so I want to avoid this problem.
Thanks so much in advance. Regards.
Pankaj





MSIYER

MSIYER
  • Full Members
  • 90 posts

Posted 28 June 2011 - 07:18

I do not think an msi can have a manifest that makes it run elevated as an exe can.
I believe you need a small exe that has the manifest and runs elevated and then calls on the msi.

The other option create a registry entry which adds a "Run as Administrator" entry into the context menu. Something like:

[code=auto:0]Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Msi.Package\shell\runas]
@="Run &As Administrator..."

[HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command]
@="msiexec /i \"%1\""

Add this to a text file and save it with .reg extension. Merge it with your registry. This can only be used on a dev machine.

Edited by MSIYER, 07 July 2011 - 06:46.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 July 2011 - 09:26

General Information > Summary Information Stream > Require Administrative Privileges = Yes
Then it should show the UAC dialog to request admin permissions before the file copy starts.

MSIYER

MSIYER
  • Full Members
  • 90 posts

Posted 05 July 2011 - 12:19

QUOTE
General Information > Summary Information Stream > Require Administrative Privileges = Yes
Then it should show the UAC dialog to request admin permissions before the file copy starts.

This method will make the msi run the UI Sequence in normal mode and requests elevation only at the Execute Sequence. This is the ideal scenario where we never make any changes to the system in the UI Sequence.

QUOTE
How can I run MSI in administrator mode automatically by double clicking it (not though command prompt)?

If we need a UAC prompt at the double-click of msi file(like we have for exes) OR need to run the full UI Sequence in elevation(for any reason), I feel, my earlier post will be applicable.

Stefan:
Enlighten me if I am on the dark side.

Edited by MSIYER, 05 July 2011 - 12:20.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 06 July 2011 - 14:59

MSIYER: I fully agree with your first statement, but I haven't tried the second (runas) and it probably doen't count as "double-clicking the msi", and also would require the user to pre-set a registry entry.
So if oyu need to elevate the UI sequence, an exe is the solution. But you really shouldn't have to, since you shouldn't make system changes in the UI sequence. And remember that the UI sequence might be skipped in various cases, like silent installs.

MSIYER

MSIYER
  • Full Members
  • 90 posts

Posted 07 July 2011 - 06:44

Thanks Stefan for your inputs.

I just wanted to bring forth various ways to attain the objective. Some methods are applicable only on the Dev machines and some can be applied anywhere.

I shall be more granular henceforth when statements made by me may have a hint of ambiguity in them.

A bootstrapper exe with elevation manifest is one such solution which can be used anywhere. This is what I recommended strongly in the first post.

The registry tweak only helps the devs and testers. This is not applicable on end-user systems.