Skip to content

feat(nsis): transition UAC elevation to pure powershell + Start-Process + RunAs#9765

Draft
mmaietta wants to merge 6 commits into
masterfrom
feat/uac-powershell
Draft

feat(nsis): transition UAC elevation to pure powershell + Start-Process + RunAs#9765
mmaietta wants to merge 6 commits into
masterfrom
feat/uac-powershell

Conversation

@mmaietta
Copy link
Copy Markdown
Collaborator

This pull request introduces a new approach for UAC (User Account Control) elevation in the NSIS updater, transitioning from the legacy elevate.exe helper to using PowerShell as the primary method. The legacy elevate.exe is retained as a fallback for environments where PowerShell is unavailable. Additional changes improve error messages and the handling of the elevation helper.

  • The NSIS updater now attempts to elevate privileges using PowerShell (Start-Process -Verb RunAs) as the primary method, falling back to elevate.exe if encountering ENOENT

@mmaietta mmaietta requested a review from Copilot May 22, 2026 02:47
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 22, 2026

🦋 Changeset detected

Latest commit: 4d01916

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
electron-updater Minor
app-builder-lib Major
dmg-builder Major
electron-builder-squirrel-windows Major
electron-builder Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Windows NSIS updater’s UAC elevation strategy by making PowerShell-based elevation (Start-Process -Verb RunAs) the primary mechanism, while keeping the legacy elevate.exe approach as a fallback when PowerShell cannot be executed.

Changes:

  • Switch NSIS install elevation from elevate.exe to powershell.exe -EncodedCommand (Start-Process ... -Verb RunAs) with ENOENT fallback to elevate.exe.
  • Make packaging of elevate.exe more tolerant when it’s absent from the NSIS directory (skip copy rather than failing).
  • Update installer failure log messaging to refer to “UAC elevation” (but still needs alignment with the actual Electron API used).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
packages/electron-updater/src/NsisUpdater.ts Implements PowerShell-based UAC elevation with fallback to elevate.exe and updates related logging.
packages/app-builder-lib/src/targets/nsis/nsisUtil.ts Adjusts elevate.exe packaging to skip copying when the binary is not present.
.changeset/sad-ends-vanish.md Declares minor version bumps for electron-updater and app-builder-lib reflecting the feature change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/electron-updater/src/NsisUpdater.ts Outdated
Comment thread packages/electron-updater/src/NsisUpdater.ts Outdated
Comment thread packages/electron-updater/src/NsisUpdater.ts Outdated
Comment thread packages/app-builder-lib/src/targets/nsis/nsisUtil.ts Outdated
Comment thread packages/electron-updater/src/NsisUpdater.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants