0
votes

I have a NSIS installer/uninstaller which install an application for the current user only. There are registry writings in HKCU in order to make the application appears in control panel. It works perfectly well. However, when I try to uninstall the application from control panel, it pop-up the admin privileges pop-up box (the AUC stuff) and run the uninstaller as admin. Therefore HKCU is related to the admin account and not the user account. In this way, a user can 'uninstall' the admin application! I need to allow a user to uninstall the application without admin privileges.

I am already using !include MultiUser.nsg et al. I've also noticed that it is possible to uninstall some random/default MS applications from control panel at user level (which doesn't require admin privileges) so I know it is possible.

1
Windows version? If this is Windows 10, are you using the settings app? - Anders
@Anders Yes, it's Win10. But what do you mean by "using the settings app"? - Spiralwise
@HarryJohnston Yes, that's work when use the uninstaller directly. But I would like to make possible to use control panel like any regular applications. - Spiralwise
Win10 has the classic control panel with "Programs and Features" and it also has the new Modern/Metro settings application. - Anders
@Anders I'm just using the classic control panel. - Spiralwise

1 Answers

1
votes

Uninstalling from the old "Programs and Features" in the classic control panel works just fine without UAC prompts. I just tested on Windows 10.0.16184 with this:

InstallDir $Temp\Test
RequestExecutionLevel user

Section
SetOutPath  "$InstDir"
WriteUninstaller "$InstDir\Uninst.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS_W10_HKCU_Test" "DisplayName" "NSIS W10 HKCU Test"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS_W10_HKCU_Test" "UninstallString" '"$InstDir\Uninst.exe"'
SectionEnd

Section Uninstall
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS_W10_HKCU_Test"
Delete "$InstDir\Uninst.exe"
RMDir "$InstDir"
SectionEnd

Classic ARP

There is however a known issue if you do the same in the settings app, it will force UAC elevation even for HKCU uninstallers: Modern ARP

This issue in the settings app has existed for a couple of years now and I don't think Microsoft cares.