Changing Local security Policy programatically

Answered Changing Local security Policy programatically

  • Tuesday, November 24, 2009 11:16 AM
     
     
    hi
    i want to change Local Security Policy "Interactive logon: do not require ctlr+alt+del" in c# how can i do this
    Regards
    Ehtsham

All Replies

  • Tuesday, November 24, 2009 4:11 PM
     
     
    Do you want to perform CTRL + ALT + DEL operation programatically?

    OR:

    Do you want to change Local Security Policy programatically?

    Regards,
    Jai
  • Thursday, November 26, 2009 8:35 AM
    Moderator
     
     Answered

    Hi,

    We can enable/disable the option by modify the registry, here is some code snippet, hope it helps:

                // CAD means "Ctrl + Alt + Del"

                string valueName = "DisableCAD";

                string subKeyPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon";

                using (RegistryKey key = Registry.LocalMachine.OpenSubKey(subKeyPath, true))

                {

                    // set the value of "DisableCAD" to 0 to enable CAD when user login.

                    key.SetValue(valueName, 0x00000000, RegistryValueKind.DWord);

     

                    // or set the value of "DisableCAD" to 1 to disable CAD when user login.

                    // key.SetValue(valueName, 0x00000001, RegistryValueKind.DWord);

                }

     

    Thanks,

    Eric


    Please remember to mark helpful replies as answers and unmark them if they provide no help.