Setting the "Run As Admin" button on a Windows app via Script/Shell?

I maintain an xplatform desktop app that uses Kaju for self-updating and a script than must be run in Admin mode to start a Windows service. So initially the app was set to highest available user rights, but then a customer of my customer demanded the app to run in user mode. I could put that script under elevated mode with an MBS command, but I cannot do so for Kaju – I guess.
If I have the app compile in elevated mode, it won’t run for a normal user – Windows will prompt for Admin access and if denied will do so with the whole app. So I put it into normal mode, which works limited as stated, and as 99% of users will have no issues with the app starting in admin mode, I’d like to have InnoSetup which I use for the Win app to set a checkmark to the “run as Admin” file property if not told so otherwise.
Is this possible? Are there any other solutions?

You might get some clues from https://blog.xojo.com/2013/08/16/guest-post-running-xojo-apps-on-windows-with-elevated-uac/

Its not straight forward. If you run your updater elevated and it is responsible for launching the new version of your application then that will run elevated.

We also have a cross platform (macOS & MS-Windows) app that has a built-in auto update feature. The method we used to solve this approx. 14 years ago was to use two auto update helper applications which are both launched by the main app:
• Helper App 1 is launched elevated using a similar method described by Wayne.
• Helper App 2 is launched as normal so that it has the same privileges as your main app.

Helper App 1 detects when the main app has quit, performs the updating tasks and then quits.
Helper App 2 detects when Helper App 1 has quit and then re-launches the new main app.

We provide both helper apps as part of the update download so that we can change what the update process has to perform.

1 Like