Take a look at this example installer:
Name "Test"
OutFile "Installer.exe"
Unicode True
!include "LogicLib.nsh"
!include "x64.nsh"
!define MULTIUSER_USE_PROGRAMFILES64
!define MULTIUSER_INSTALLMODE_INSTDIR "$(^Name)"
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!include "MultiUser.nsh"
!include "MUI2.nsh"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Function .onInit
!insertmacro MULTIUSER_INIT
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd
Section
SetOutPath "$INSTDIR"
File test.exe
CreateShortcut "$SMPROGRAMS\test.lnk" "$INSTDIR\Uninstall.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Uninstall"
RMDir /r "$INSTDIR"
Delete "$SMPROGRAMS\test.lnk"
MessageBox MB_OK "$SMPROGRAMS"
SectionEnd
The User can choose if he want to install it system wide (if he has Admin permission) or only for his own Account. The Installation itself works great, but not the Uninstall. If a User with Admin permission chooses to install into it's own account instead of system wide, it get's installed there. But if you try to uninstall it, $SMPROGRAMS will point to the System location instead of the User one, which does it not made work correctly.
Try setting MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY and MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME.
I added
above the MultiUser include, but it didn't change anything and I can't find anything in the Registry.
I guess you are responsible for writing. MultiUser will only read it.
Last edit: Anders 2022-11-12