C# Group Policy RRS feed

  • Question


    Can I edit GPO's of system or manage gpedit.msc with C#? It's possible?
    Saturday, October 13, 2007 1:57 AM


  • You can find these settings in HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\ in the Registry.

    For example, the following code can enable/disable the TaskManager:

    Code Block

        private static void EnableTaskManager(bool enable)
            Microsoft.Win32.RegistryKey HKCU = Microsoft.Win32.Registry.CurrentUser;
            Microsoft.Win32.RegistryKey key = HKCU.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
            key.SetValue("DisableTaskMgr", enable ? 0 : 1, Microsoft.Win32.RegistryValueKind.DWord);


    Be sure you have good reason to do it.


    Best Regards

    Chunsheng Tang

    Tuesday, October 16, 2007 10:30 AM

All replies