Disabling UAC programmatically

♀尐吖头ヾ 提交于 2019-11-27 04:24:37

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.

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.

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

namrokretep

I posted a somewhat granular (but ugly) solution here

http://stackoverflow.com/questions/5344021/bypass-uac-in-vbscript/34445992#34445992

It only works if you can kick off the application from the task scheduler. I have it running on two Windows 7 laptops. It is an administrative solution. You need administrator privilege to implement it. I use it for powershell and for my UPS power backup application. I suspect I'll find other uses.

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!

UAC is a necessary evil alike the use of semaphores on a city. I suggest adapting to the new paradigm. I personally don't like UAC; but I understand the purpose and benefits. Unfortunately, we all created this monster. Lest's go back to 1983, do a short assessment of the changes throughout the years and then, we will understand. Of course, if the intent is for private use, anything is possible, as pointed above; but it would be risky and become a black hole liability.

I created a small application to do this, but basically there are 4 registry keys you need to set.

C# example:

Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System","EnableLUA", 0);

Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "ConsentPromptBehaviorAdmin", 0);

Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", "PromptOnSecureDesktop", 0);

Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Action Center\\Checks\\{C8E6F269-B90A-4053-A3BE-499AFCEC98C4}.check.0", "CheckSetting", StringToByteArray("23004100430042006C006F00620000000000000000000000010000000000000000000000"), RegistryValueKind.Binary);

My application runs as a service every 5 minutes to "fight" Group Policy on this, which is an absolute annoyance for a developer machine.

https://github.com/zleight1/DisableUAC

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!