1

When users try to uninstall their own single user installation (for example installed using lowestprivileges none and HKCU entries) with 'Add/Remove Programs' in the Control Panel, everything works fine (that is, non-admin users can uninstall their own non-admin installation).

However the uninstaller will be elevated, when users start it from 'Apps & features' (Windows 10).

This seems to be a known Windows 10 bug:
How to prevent uninstaller elevating for Standard Windows 10 user?

Is there a way to work-around this issue when the Inno Setup uninstaller is started from 'Apps & features'? Link this NSIS Workaround for Windows uninstaller elevation bug.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Btw, did you consider preventing the uninstallation as admin and suggesting the user to go to Control panel instead? – Martin Prikryl Feb 05 '20 at 13:17
  • Yes, I did. But I would like to make it impossible for users which can elevate the uninstaller to run the installer elevated, because experience shows users ignore that message ... However there is an issue when an admin user has UAC turned off, because isAdminLoggedOn is only false when UAC is on for the admin ... Ok, how about this idea, during the installation I save the "user" with SetPreviousData, and then use that for the restart. Or are there any caveats with that approach? – overflowguy Feb 05 '20 at 13:35
  • *"I would like to make it impossible for users which can elevate the uninstaller to run the installer elevated"* – That's what have meant. – Martin Prikryl Feb 05 '20 at 13:43
  • You cannot use `SetPreviousData`, as that's user specific. And you do not know what user you want. – Martin Prikryl Feb 05 '20 at 13:44

1 Answers1

0

You will have to do exactly what that NSIS hack does.

  1. Find out what is the Windows GUI user (and assume that you should uninstall as that user). Alternatively, you can store the username into some file in the installation folder.

  2. Re-execute the installer as that user. That hack uses StdUtils NSIS plug-in with its ExecShellAsUser function. Maybe the DLL can be used from Inno Setup. If not, you can at least reuse its code.

All this is imo to much to ask in a single question. If you have specific problems, consider asking more specific questions.


Simpler alternative would be to prevent the uninstallation, when executed as different user, and show a suggestion to the user to go to Control panel instead.

For a similar question, see Uninstaller trouble with standard Windows user.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992