Skip to content
⌘ NSIS Forum Archive

Don't run Setup if user isn't Administrator

7 posts

pegase06#

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:


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

Thanks for reply
Red Wine#
With a message box I guess...
If condition is true, continue, else pop up a message box before abort.
Red Wine#
Provided that you use the function from this wiki page,



!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