Advertisement
Anders

RequireAdmin NSIS

Mar 15th, 2011
4,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Outfile RequireAdmin.exe
  2.  
  3. ; BEGIN 8< 8< 8< 8< 8< 8< 8< 8<
  4. ; BEGIN 8< 8< 8< 8< 8< 8< 8< 8<
  5. ; BEGIN 8< 8< 8< 8< 8< 8< 8< 8<
  6.  
  7. RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
  8.  
  9. !include LogicLib.nsh
  10.  
  11. Function .onInit
  12. UserInfo::GetAccountType
  13. pop $0
  14. ${If} $0 != "admin" ;Require admin rights on NT4+
  15.     MessageBox mb_iconstop "Administrator rights required!"
  16.     SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
  17.     Quit
  18. ${EndIf}
  19. FunctionEnd
  20.  
  21. ; END >8 >8 >8 >8 >8 >8 >8 >8
  22. ; END >8 >8 >8 >8 >8 >8 >8 >8
  23. ; END >8 >8 >8 >8 >8 >8 >8 >8
  24.  
  25. Page InstFiles
  26.  
  27. Section
  28. SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement