Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine why application is prompting for elevation

When launching my executable, Windows is prompting for elevation, when it shouldn't be.

How can i figure out why Windows is prompting me to elevate my executable on launch?

Notes:

  • there is no manifest resource (asking for asAdministrator, or otherwise)
  • there is no manifest file
  • the compatibilty tab (for all users and just me) has the "Run as administrator" not checked

How can i determine why my application is prompting for elevation?

like image 245
Ian Boyd Avatar asked Oct 19 '25 14:10

Ian Boyd


1 Answers

In the absence of a manifest, the usual reasons are name heuristics (eg your file is called setup.exe) and group policy (which you may have set accidentally after a "this program may not have run as expected" dialog.)

To prevent it, simply apply a manifest (embedded or external) with asInvoker. Then you will no longer care about these heuristic and you will not elevate.

I know I commented this above but I need to repeat it: What your code tries to do will NEVER cause elevation. NEVER. Stuff that won't work unless you're elevated fails when you're not elevated. It doesn't elevate you.

like image 152
Kate Gregory Avatar answered Oct 22 '25 04:10

Kate Gregory



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!