Archive: Don't run Setup if user isn't Administrator


Don't run Setup if user isn't Administrator
Hello,

I search how to don't run my setup if the user isn't an Administrator.

I have found this page to check if the current user is an Administrator:
http://nsis.sourceforge.net/Check_if..._Administrator

But I don't know how to show a message if the user isn't an Admninistrator and exit the setup.

Thanks for reply


Re: Don't run Setup if user isn't Administrator


With a message box I guess...
If condition is true, continue, else pop up a message box before abort.


how to abort, I use MUI PAGE ?


Provided that you use the function from this wiki page,

http://nsis.sourceforge.net/IsUserAdmin

!include "LogicLib.nsh"

Function .onInit
Call IsUserAdmin
Pop $R0
${if} $R0 == "false"
MessageBox MB_OK|MB_ICONSTOP "Installing my application requires admin rights"
Abort
${EndIf}
FunctionEnd

Thank you very much Red Wine :)


That code will probably not work on vista for a member of the admin group with UAC on