Skip to content

NSIS silent install with selectPerMachineByDefault: true skips UAC on fresh install #9644

@gzdunek

Description

@gzdunek
  • Electron-Builder Version: 26.8.2
  • Node Version: 24.14.0
  • Electron Version: 40.1.0
  • Target: NSIS

When using NSIS multi-user mode (oneClick: false) with selectPerMachineByDefault: true, a fresh silent install (/S) does not trigger UAC and fails due to insufficient privileges.

Running the silent installation from an administrator console works correctly.

To Reproduce

  1. Configure NSIS:
    • oneClick: false
    • perMachine: false
    • selectPerMachineByDefault: true
  2. Run fresh install as non-admin:
    • MyAppSetup.exe /S
  3. The app is not installed, no error is displayed.

Suspected root cause

In packages/app-builder-lib/templates/nsis/installer.nsi, UAC in silent mode is triggered only when there is a previous per-machine installation, the resolved mode is ignored:

${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser
${andIf} ${Silent}

Proposed fix

Broaden condition to include resolved per-machine mode:

${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser 
${OrIf} $installMode == "all"
${andIf} ${Silent}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions