Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What actions will require UAC elevation in Windows?

I'm marking this as a community wiki because I'm not really looking for one complete answer. So if you feel like posting one or two things that will activate the UAC prompt instead of a comprehensive list then go ahead.

What actions in Windows will activate UAC? I'd like to avoid it as much as possible because my application doesn't need admin privileges. And I'm sure many other people want to avoid it.

Specifically, I would like to know if reading from the registry would activate it. Or writing to it?
You don't need to address the above question, just anything that will activate it is fair game.

It's really hard to Google anything about UAC because you get bombarded with articles about how to disable it. And I'd rather not have my application make the assumption UAC is disabled.


1 Answers

Nothing "activates" UAC.

If your application would fail to run as a standard user under Windows XP it will fail to run under Windows Vista or Windows 7 as a standard user.

What you are really asking is: what actions can a standard user not perform under Windows?

The things a standard user cannot do are pretty well known (they've been the same since Windows 2000). The main ones are:

  • modify anything in HKEY_LOCAL_MACHINE
  • modify anything in the Windows directory
  • modify anything in the Program Files folder

If you try to do any of those they will fail on:

  • Windows 2000
  • Windows XP
  • Windows Vista
  • Windows 7

Nobody should have been running as an administrator for day-to-day computer use. If your application did any of those bad things in Windows XP it would fail. The user would have to:

  • logon (or fast user switch) to an administrator
  • perform the administrative task
  • switch back to their real account

UAC is a convience mechanism, allowing you to easily temporarily switch to an administrator. Nothing you do will "trigger" it; you have to make it happen.

If you know your code needs to modify a file in C:\Program Files\My App\Data, then you should add a button on your form that will trigger the elevation.

You then need to launch an (elevated) copy of your program, do the thing, and close.

like image 75
zeroFruit Avatar answered Oct 25 '25 17:10

zeroFruit