Skip to content
⌘ NSIS Forum Archive

Detecting administrator rights?

3 posts

cowwoc#

Detecting administrator rights?

Hi,

I want to be able to detect whether the user has admin rights or not. I want to install a public JRE on his machine and to my knowledge this requires admin access. If he does not have admin access, I will try installing a private JRE but this should be done as a last resort.

Ideas?

Gili
Takhir#
Not admin user may have some permissions too. This is how I do this:

Function .onInit

; Hand made permissions checkout
WriteRegStr HKLM "${REG_UNINST}" "TestString" "Some text"
IfErrors 0 cleanValue
MessageBox MB_OK "$(adminMsg)"
Abort
cleanValue:
DeleteRegValue HKLM "${REG_UNINST}" "TestString"
DeleteRegKey /ifempty HKLM "${REG_UNINST}"

FunctionEnd