Old 18th October 2010, 12:49   #1
floydmovie
Junior Member
 
Join Date: Oct 2010
Posts: 2
Question 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
floydmovie is offline   Reply With Quote
Old 18th October 2010, 13:04   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
NSIS run as admin
jpderuiter is offline   Reply With Quote
Old 18th October 2010, 13:10   #3
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 304
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.
Wizou is offline   Reply With Quote
Old 18th October 2010, 13:34   #4
floydmovie
Junior Member
 
Join Date: Oct 2010
Posts: 2
Thanks for the quick reply.

Can you do me a small example?
floydmovie is offline   Reply With Quote
Old 18th October 2010, 13:48   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by Wizou View Post
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th October 2010, 15:42   #6
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 304
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.
Wizou is offline   Reply With Quote
Old 18th October 2010, 16:15   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by Wizou View Post
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!

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th October 2010, 16:57   #8
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 304
Quote:
Originally Posted by Anders View Post
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
Wizou is offline   Reply With Quote
Old 18th October 2010, 20:34   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by Wizou View Post
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.
MSG is offline   Reply With Quote
Old 20th October 2010, 02:32   #10
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 304
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.
Wizou is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump