question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request administrator rights for portable application

See original GitHub issue
  • Version: 22.4.1
  • Electron Version: 8.2.2
  • Electron Type (current, beta, nightly): current
  • Target: portable

Hi,

My issue is rather a question. I’m trying to package an application with the portable target that requests administrator privileges to run. I set the option in the electron-builder.json:

"win": {
    "icon": "dist/assets/icons",
    "target": [
      "portable"
    ],
    "requestedExecutionLevel": "requireAdministrator"
  },

The unpacked exe file requests administrator rights to be open, but the packed, portable exe file does not. Is there a way to make the portable exe file request administrator rights?

I have looked into the manifest of the portable exe file, and it shows that the requestedExecutionLevel is set to asInvoker instead of requireAdministrator. I also tried editing the manifest with mt.exe, but then when I want to launch the app, it crashes with an NSIS error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
mxswatcommented, Jul 2, 2020

@koppa96 I foud a solution

"win": {
                    "target": ["portable"],
                },
                "portable": {
                    "artifactName": "R6CGT_portable.exe",
                    "requestExecutionLevel": "admin"
                },
1reaction
tutiplaincommented, Aug 3, 2021

I know this issue is closed, but I’d like to point out that the options which solve the issue do not appear in electron-builder’s documentation. Are there any plans to add them? This issue stumped me for days before I came across this post. If it were documented, it would’ve saved me a lot of time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run-As-Administrator rights for Portable Apps
Almost none of our apps require admin rights. The HKCU area of the registry is read and written just fine by Limited accounts....
Read more >
windows 10, grant a specific application PERMANENT ...
Click on Start and select All apps, locate the app, right click on it and ... Check the option 'Run this program as...
Read more >
How to Run Program without Admin Privileges and to Bypass ...
An app may need the administrator privileges to modify some files (logs, configs, etc.) in its own folder in the C:\Program Files (x86)\SomeApp....
Read more >
How do I install an application to my USB and get it to work on ...
Most applications require administrative privileges not only to write to the disk (in your case USB) but also: Write to registry.
Read more >
Run As Administrator (App Elevation) - Admin By Request
So what happened? Admin By Request intercepted the browsers' request to elevate with admin rights to install the software and then executed the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found