Archive: Launch program as admin from user priviledge script


Launch program as admin from user priviledge script
I have an NSIS script that currently runs with only user privileges just fine, but I want to run an external application from my script that requires admin privileges. When I try to do this currently, it just does nothing. Is there any way to elevate the external app that needs it without requiring admin elevation for the whole script? As it stands, if the only answer is to RequestExecutionLevel highest, I will just drop the whole thing. I absolutely do not want to do this, as the external app, while it would be very nice to have that ability, is still a small, non-integral part of the script. Thank you.


If the external app requires "admin" rights, then the external app itself should request the required rights instead of just failing. But if you need to deal with the external app "as-is", then you could make a dummy installer. While your main installer runs at "user" level, the dummy runs at "admin" level. That can be done using RequestExecutionLevel. The main installer will launch the dummy and the dummy will launch the external application at elevated execution level.

Also the UAC Plugin for NSIS may be worth a look, although that plugin is more intended to run an external app at "user" level from an installer that is running at "admin" level.

BTW: Why not run the installer with "admin" rights? Most things an installer has to do will require that anyway...


I don't want to run the whole thing as admin because it's not an installer, it's a portable application launcher (see portableapps.com). For portability's sake, it should be able to run as a normal user, as 99% of the app doesn't need admin privileges. Unfortunately that 1% (which is actually a separate executable from the main app, so it gets run separately) simply fails to run when launched from a script that is running with user privileges. I will try the dummy script idea and see how that works.