1

My script detects if the .Net FW is installed, if not it starts the installer. The problem is that because of PrivilegesRequired=none, an error message pops up, instead of asking for the admin password.

I want to keep PrivilegesRequired=none because if the user already has the .Net FW, I don't want him/her to bother with the admin password.

Thanks for your help!

Oscar Fonseca
  • 226
  • 2
  • 6
  • 1
    You can (Shell)execute that .NET setup with `runas` verb. That tells the Shell to ask for administrator elevation. – TLama May 19 '15 at 09:58
  • You're welcome! There's yet quite a hacky way to [`elevate the setup itself`](http://stackoverflow.com/q/21556853/960757), but in your case is better to just elevate that single 3rd party installer (it would make sense if you were executing more of them). – TLama May 21 '15 at 08:10
  • P.S. please post the solution as an answer. You are free to answer and accept your own questions and I would be glad if you do so. – TLama May 21 '15 at 11:55

1 Answers1

0

This is the solution after TLama's reply:

if not ShellExec('runas', ExpandConstant('{tmp}\mu_.net_fx_4_5_1_windows_vistasp2_windows_7sp1_windows_8_windows_server_2008sp2_windows_server_2008r2sp1_windows_server_2012_x86_x64_3009816.exe'), '/q /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      // you can interact with the user that the installation failed
    end;
Oscar Fonseca
  • 226
  • 2
  • 6