views:

1280

answers:

5

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.

A: 

That would defeat the object of UAC. So no, you can't.

blowdart
of course you can :) as long as program is running as admin.
Erx_VB.NExT.Coder
+9  A: 

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

jkottnauer
It pretty much is :P
Lucas McCoy
well, it is possible, as long as you are running as admin.
Erx_VB.NExT.Coder
+10  A: 

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.

Reed Copsey
Hi Reed,I am making an installer(which has the above permissions) which runs ServiceModelReg.exe, but it ends with an error...whereas running it with manually elevating permissions from Control panel...every thing works fine
taher chhabrawala
read my answer, you can disable UAC as long as you are running under admin priviledge!
Erx_VB.NExT.Coder
@Erx_VB.NExT.Coder: That forces a reboot, though. It isn't what I'd call a programatic change, but a configuration change. It really doesn't help, since the user could just change the systme config in that case.
Reed Copsey
+1  A: 

Disabling UAC programmatically would defeat its purpose as this would then also be possible to be done by malware, worms, trojans and virusses and have no real security-effect at all.

You could require to run your application under the admin-account or (I think) let Microsoft somehow sign your application.

There may be other ways I'm not aware of, but none of them is programmatically!

Kosi2801
of course you can disable UAC and any accompanying message related to it as long as you are running the program under admin priviledge!
Erx_VB.NExT.Coder
Since the question was related to currently having the application being started in a restricted way it would not be possible under that conditions. Of course, as I said too, requiring it to be started with admin-privileges would do the trick. And since it shouldn't have to happen manually each time the answer still applies.So the accepted answer, how to automatically start the elevated mode is correctly chosen.
Kosi2801
+1  A: 

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.

it turns out stackoverflow is censoring comments that show how ti disable UAC as my post/thread with above answer from a diligent answerer was removed.

Erx_VB.NExT.Coder
UAC is in fact broken in several ways. I can see why some otherwise correct programs would fail rather spectacularly when UAC is enabled.
Joshua
+1 for the trick, but would UAC let us modify the registry value in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System without warning the user on the recieving end?
Omair Iqbal
well, as long as you are running the program (exe) under admin (ie person running app has accepted to run it as admin) then you actually can do the registry trick without the user being told anything, in VISTA, in Win7, you can still do it, but user will get notification saying 'you need to restart your computer in order for UAC to take effect' - this doesn't interupt the process, just implies to user that disabling occured... but if you want, you can turn that msg off as well with another registry trick :), so, it always 'works' as long as running as admin.
Erx_VB.NExT.Coder
i also suggest you mark this as the answer, since every other answer was vhastly misinformed in my opinion
Erx_VB.NExT.Coder
Disabling UAC globally for the whole computer just to make one (avoidable) issue easier for a single application? Why not just also de-install all Virus-Scanners because the warn you too often?Lowering security to enhance usability is never a solution in my opinion.
Kosi2801