pegase06
16th March 2007 10:59 UTC
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
pegase06
16th March 2007 11:09 UTC
Re: Don't run Setup if user isn't Administrator
Red Wine
16th March 2007 11:46 UTC
With a message box I guess...
If condition is true, continue, else pop up a message box before abort.
pegase06
16th March 2007 13:36 UTC
how to abort, I use MUI PAGE ?
Red Wine
16th March 2007 13:44 UTC
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
pegase06
20th March 2007 12:13 UTC
Thank you very much Red Wine :)
Anders
20th March 2007 18:34 UTC
That code will probably not work on vista for a member of the admin group with UAC on