- NSIS Discussion
- NSIS run as admin!!!
Archive: NSIS run as admin!!!
floydmovie
18th October 2010 13:49 UTC
NSIS run as admin!!!
I need help by my NSIS project.
Is it possible for NSIS to be executed automatically as admin.
The problem is on Windows 7 and Vista, there is an error.
For my clients it is too complicated to run as Admin.
Thanks...
Grz Floydmovie
jpderuiter
18th October 2010 14:04 UTC
NSIS run as admin
Wizou
18th October 2010 14:10 UTC
mmh in this case, Google doesn't give the first trivial answer to floydmovie's question:
Just use RequestExecutionLevel admin in your script and your users will be automatically prompted to let your installer run as admin.
No need of plugins for this.
floydmovie
18th October 2010 14:34 UTC
Thanks for the quick reply.
Can you do me a small example?
Anders
18th October 2010 14:48 UTC
Originally posted by Wizou
Just use RequestExecutionLevel admin in your script and your users will be automatically prompted to let your installer run as admin.
No need of plugins for this.
Sadly this is not true, RequestExecutionLevel is only half the job
See
http://nsis.pastebin.com/63tS3AS2 for a proper example.
Wizou
18th October 2010 16:42 UTC
Oh, I thought floydmovie expected his installer to be run only on Windows 7 & Vista. My bad.
Of course there can be problems with non-admin accounts on prior version of Windows, but floydmovie said he didn't have any problem on prior versions...
This is probably because 90% of users of these older versions of Windows have admin accounts.
If you want to deal with the 10% users left, you can use the link given by Anders for a solution.
Anders
18th October 2010 17:15 UTC
Originally posted by Wizou
Oh, I thought floydmovie expected his installer to be run only on Windows 7 & Vista. My bad.
Of course there can be problems with non-admin accounts on prior version of Windows, but floydmovie said he didn't have any problem on prior versions...
This is probably because 90% of users of these older versions of Windows have admin accounts.
If you want to deal with the 10% users left, you can use the link given by Anders for a solution.
Wrong again! On vista when UAC is off, RequestExecutionLevel has no effect!
Wizou
18th October 2010 17:57 UTC
Originally posted by Anders
Wrong again! On vista when UAC is off, RequestExecutionLevel has no effect!
Ok, when UAC is off, and your account is non-admin, there is not much you can do anyway.. and the user probably already knows he can't install programs..
I have faced this case, and there is no possibility for an installer to obtain admin rights, even asking for a admin account.
So NSIS will fail anyway, sooner or later.
If you want to be nice, all you can do is detect this case and display a MessageBox saying "you're screwed!"
PS: Of course I'm not talking about programs that can be installed completely using user-only folder/registry
MSG
18th October 2010 21:34 UTC
Originally posted by Wizou
If you want to be nice, all you can do is detect this case and display a MessageBox saying "you're screwed!"
And that is exactly what you have to do, because otherwise the installer will fail halfway when trying to do something restricted to admin users, and the user will come complaining that your installer is broken.
Anders is absolute correct in his statements.
Wizou
20th October 2010 03:32 UTC
Sure, and that's what I personally do in my own installers..
But I just don't expect every NSIS users to be ready to go to this extent of covering every cases, especially this (rare in my opinion) case of a non-admin users trying to install a program while UAC is disabled.
Anders
20th October 2010 12:06 UTC
Originally posted by Wizou
But I just don't expect every NSIS users to be ready to go to this extent of covering every cases, especially this (rare in my opinion) case of a non-admin users trying to install a program while UAC is disabled.
They will if we tell them the correct way from the start.
Besides, the number of users still on XP is pretty high. Even if the first post only talks about Vista/7, you can assume that the same problem exists on NT4+ and that they have just not tested as non admins.