none
Changing Local security Policy programatically

    Question

  • 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
    Tuesday, November 24, 2009 11:16 AM

Answers

  • 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.
    • Marked as answer by eryang Monday, November 30, 2009 3:09 AM
    Thursday, November 26, 2009 8:35 AM

All replies

  • Do you want to perform CTRL + ALT + DEL operation programatically?

    OR:

    Do you want to change Local Security Policy programatically?

    Regards,
    Jai
    Tuesday, November 24, 2009 4:11 PM
  • 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.
    • Marked as answer by eryang Monday, November 30, 2009 3:09 AM
    Thursday, November 26, 2009 8:35 AM