How can I make the installer Run as admin
Asked Answered
I

2

19

My application has an installer built in installshield. But for proper working of installation process in vista Win 7 etc. the installer should be run as administrator. (Even though the user has admin previlege he should select the 'Run as Administrator' option in the menu on rightclicking the installer exe)

How can I make my installer to prompt that it should be always run as administrator.

Thanks in advance...

Imprecision answered 22/2, 2012 at 19:22 Comment(1)
I would recommend figuring out whether there is an inherent need for administrative privileges, or if there is a mistake in the authoring (such as failing to use deferred-in-system-context for custom actions that require elevation) that could be corrected. If the latter, it's better to correct it than to set the manifest option.Howerton
F
17

You need to set the execution level to "Require Administrator" from the project options. This option will be stored in the manifest file included in your setup package and it will make the installer to act as it was launched with the option "Run as administrator" on machines that run on Vista or a newer OS. Older versions of Windows will ignore the manifest file.

Fated answered 22/2, 2012 at 20:31 Comment(1)
@Bogdan Mitrache And if my installer is an MSI and NOT setup.exe?Strongwilled
I
25

With InstallShield 2008 (14.0) go to Media -> Releases then select tab Setup.exe and change the item Required Execution Level to Administrator

enter image description here

Interior answered 29/7, 2013 at 14:32 Comment(3)
And if my installer is an MSI and NOT setup.exe?Strongwilled
@Strongwilled An MSI is not an executable file, it is just a standard Windows Installer database that is loaded by an executable from the system, i.e. msiexec.exe. So the answer is unfortunately, no. The manifest which specifies the execution level can be only embed into an EXE bootstrapper that launches your MSI (by calling msiexec.exe in in the background and passing its execution level too). An MSI can only be executed as admin from an elevated command prompt if it is manually launched, but never by simply double clicking it.Fated
@Bogdan Mitrache thanks for your answer. this is what actually we're doing but I thought there is more elegant way.Strongwilled
F
17

You need to set the execution level to "Require Administrator" from the project options. This option will be stored in the manifest file included in your setup package and it will make the installer to act as it was launched with the option "Run as administrator" on machines that run on Vista or a newer OS. Older versions of Windows will ignore the manifest file.

Fated answered 22/2, 2012 at 20:31 Comment(1)
@Bogdan Mitrache And if my installer is an MSI and NOT setup.exe?Strongwilled

© 2022 - 2024 — McMap. All rights reserved.