I want to execute ExecWait
in NSIS with admin privileges, I was unable to find any documentation on this issue.
Execute a Execwait in NSIS with administrative privileges
Asked Answered
Generally I would recommend that the whole installer should run elevated in a case like this, it makes it clear to the user up-front that elevation is required.
If you cannot do this then you should make sure that the program you want to run requests administrator rights. For this to work you need to launch the program with ExecShell.
If that program does not requests administrator rights you basically have two options:
- Use
ExecShell
with the "runas" verb and hope for the best (Fails if the user is not a member of the administrators group, UAC is off or on < Vista) - Write a small launcher application that requests administrator rights and then launches the real program.
I tried the second option (Write a small launcher with admin request) ... and it didn't work. –
Refectory
@jing: Provide some more details or ask it as a question maybe? –
Punjabi
@Anders: I did what you proposed: Parent NSIS package requested only user privileges (RequestExecutionLevel user), child NSIS package requested admin privileges (RequestExecutionLevel admin). I can launch child from OS. But parent NSIS package fails to launch child using ExecWait. Parent NSIS package launches child one only after right-click "Run As Administrator". Anyway I don't expect such process can work correctly. –
Refectory
You cannot use ExecWait, you have to use ExecShell because UAC is only hooked into the shell and not as deep as CreateProcess. –
Punjabi
© 2022 - 2024 — McMap. All rights reserved.