Inno Setup : How to set installer “Run As Administrator”

inno-setup

In Inno Setup,

[Setup] 
PrivilegesRequired=admin 

is still can not Run the installer as Administrator, but I need to Launch my Program at last step of Inno Setup.

How can I do to set my Installer can Run as Administrator ?

Best Answer

I have been having this same problem as well, it took me quite a bit of time to figure out that after you have set the PrivilegesRequired=admin you also need to add runascurrentuser to all the [Run]Flags.

[Setup]
PrivilegesRequired=admin

[Run]
Filename: "{app}\MyApp.exe"; Description: "{cm:LaunchProgram,MyApp}"; Flags: runascurrentuser nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\MyApp.exe"; Flags: runascurrentuser; Parameters: "-install -svcName ""MyApp"" -svcDesc ""MyApp"" -mainExe ""MyApp.exe""  "; Check: returnFalse()

I know you have probably already figured out the issue considering this question was asked over two years ago but I thought I would answer it anyway for others like myself who found this unanswered question but would have really liked to have seen an answer.