Archive: run installed app as administrator, and remove services


run installed app as administrator, and remove services
Hi all,
I have an nsis installer, that installs a few applications.
it works in windows xp, but in widnows 7, there are a few problems, and I'm sure nsis has a plugin for me, but can't figure it out for the likes of me.

The application, which needs to run at startup, is always prompted with "needs to run as administrator". My understanding, is that a shortcut with the checked "run as administrator" needs to be included? how is this accomplished with NSIS?

also, another service application, gets installed and runs fine, but when the user tries to remove it, via the installer, it won't work: needs administrative permission to remove (because the uninstaller runs a batch file,to remove the services). Is there an nsis plugin that allows the removal of a service, instead of a batch file?

thanks!


Originally posted by technobuddha
The application, which needs to run at startup, is always prompted with "needs to run as administrator". My understanding, is that a shortcut with the checked "run as administrator" needs to be included? how is this accomplished with NSIS?
http://forums.winamp.com/showthread....+administrator - Create a shortcut link which has "Run as administrator" option enabled on Vista
http://forums.winamp.com/showthread....+administrator - CreateShortcut to run as administrator

Note that this won't -remove- the prompt for elevation to Administrator, though. In fact, if the application already asks for it, then the shortcut flag won't change anything. The shortcut flag is needed for applications that do -not- attempt to elevate themselves to Administrator (i.e. you double-click on it, and it runs as User), but you always want to run as Administrator anyway (so that double-clicking on it will prompt for Administrator elevation, etc.).

Is there an nsis plugin that allows the removal of a service, instead of a batch file?
http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin

sooo, then how does NSIS able to create an installer, that allows for an application to startup WITHOUT being prompted for administration privilage? this application needs it, and i suspect what your saying, is that at this time, NSIS can't do that then?


If an application requires administrative access, then naturally there's nothing you can do about that. If it needs it, it needs it. Not even NSIS can change that.

What makes you think you can run an application without what it needs? You wouldn't expect your PC to start running without the electricity it requires, would you?


One potential confusing situation is when you build an installer that requires Admin access, so you 'RequestExecutionLevel admin' in your installer. Now the installer process has Admin privileges. Next up you install an application that requires Administrator privileges and on the Finish page you add a "Run MyProgram now" option. The user leaves that checked, finishes the installer, and the application ruins.. without an elevation prompt. So what happens there? The installer with its Admin privileges process launches another process (the application) - and this process automatically takes on the same privileges (roughly speaking) as the process that launched it (the installer). Hence no renewed elevation required.

This is typically -not- desired, though, and is one of the main reasons the UAC plugin exists, for example... to specifically launch an application as User even if the installer runs with Admin privileges.


Yep,thanks Animaether for the suggestion, I used the NSIS_Simple_Service_Plugin, and it works! with regards to 'RequestExecutionLevel admin', I'll add that!!!

I hope this works, and i'll find out tomorrow... I appreciate your time!


Originally posted by technobuddha
Yep,thanks Animaether for the suggestion, I used the NSIS_Simple_Service_Plugin, and it works! with regards to 'RequestExecutionLevel admin', I'll add that!!!

I hope this works, and i'll find out tomorrow... I appreciate your time!
I'm not entirely convinced you understood what I wrote :)

If you add "RequestExecutionLevel admin" to your installer, then the user will be prompted for elevation when they run the installer, but not be prompted again when the installer runs the application.
However, if the user -themselves- run the application (presuming they're not running under an admin shell/etc.), they -will- still be prompted. There's just no way around that other than getting the application's developer to release a non-Admin-required version of the application. Presumably it needs Admin for a reason, though :)