I have an NSIS installer script that generates an Uninstaller. The Uninstaller, when created, requires elevated permissions in order to be executed. Certain requirements make it such that I need to be able to run the uninstaller as any user without the elevated permission level. None of the other files that are generated are set with elevated permissions, not even the application executable itself. Is there any way to set the permission level to any user? Here is my NSIS script. I have removed a lot from the script so that the application stays anonymous, but have left everything that I think is relevant
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin"
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
${IfNot} ${AtLeastWin7}
MessageBox MB_OK "Application requires at minimum Windows 7 as the installed operating system. Exiting installation..."
Quit
${EndIf}
IntOp $0 ${SF_SELECTED} | ${SF_RO}
SectionSetFlags ${SecApp} $0
FunctionEnd
; sections
Section "AppSection" SecApp
... installer stuff
WriteRegStr HKCU "${AppRegistryPath}" \
"UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteUninstaller "$INSTDIR\Uninstall.exe"
... more installer stuff
SectionEnd
Section "Uninstall"
; code that terminates the running application
; code that removes a firewall rule
DetailPrint "Removing files and directories"
Delete "$INSTDIR\*"
Delete "$INSTDIR\x86\*"
Delete "$INSTDIR\x64\*"
Delete "$INSTDIR\fonts\*"
RMDir "$INSTDIR\x86"
RMDir "$INSTDIR\x64"
RMDir "$INSTDIR\fonts"
RMDir "$INSTDIR"
DetailPrint "Removing registry values"
DeleteRegKey HKCU "${AppRegistryPath}"
DeleteRegKey HKCU "${AppPath}"
DeleteRegKey HKLM "${AppRegistryPath}"
DeleteRegKey HKLM "${AppPath}"
SectionEnd