C# change windows UAC level to Always Notify

孤者浪人 提交于 2019-12-24 03:27:54

问题


I want to change the UAC level of the machine to "Always Notify" level which is the top level.

I tried changing the following registry key value to 1. Key = HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

const string UACkey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System";
            const string Subkey = "EnableLUA";
RegistryUtilities.SetValue(UACkey, Subkey, **1**, Microsoft.Win32.RegistryValueKind.DWord, RegistryUtilities.WOW64Key.Key64);

This result in UAC to be in 3rd level (Notify when programms try to make changes).

How to set it to top level?


回答1:


I managed to find this by changing UAC and having regedit open at the same time, and watching which values changed.

When on the top setting, the value

ConsentPromptBehaviorAdmin

changes to 2, rather than 5 when it's on the 3rd level (nice logic there Microsoft). Changing that value as well as EnableLUA should do it.

Hope this helps



来源:https://stackoverflow.com/questions/11611516/c-sharp-change-windows-uac-level-to-always-notify

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