Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top