Disabling UAC programmatically

Is it possible to programmatically disable UAC in Vista? Or, can I make my application run unrestricted by the UAC setting in any way? FYI, the application needs to mount hard drives on the fly, which is why I can't ask for UAC permission each time...

Update:

I'm looking for something in line with what Kosi2801 mentioned, basically to ask the user to always start the program in an 'elevated' mode. I'd want the permission to be a 1 time thing, I'm not saying that I programmatically disable UAC without asking permission first. I'm sure there are lots of programs that need to operate in this mode (especially hardware-related programs) so there should be some type of way to accommodate it.


Solution 1:

Set the EnableLUA DWORD value in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System to 0 and reboot.

this will disable UAC without a problem, i would do it to all your users, with or without permission is up to you, because the vista UAC is so horrid that i do believe the less people that have it on the better (in vista only) it is now better in win7.

have fun with my registry trick :)

works in win7 as well, let me know how you got along with it.

Solution 2:

You can't programmatically disable UAC, but you can force the program to run with elevated privileges from the start, so it doesn't prompt each time.

That will cause it to prompt once on startup, but not each time it needs access.

To do this, you'll need to create a manifest file and set <requestedExecutionLevel level="requireAdministrator">

See MSDN for details.

Solution 3:

The purpose of UAC is to prevent executing unwanted applications. If it was possible to disable it programatically it would be worthless.