views:

134

answers:

1

i have used following code to disable the Windows Control Panel. It successfully disables the Control Panel, but it needs a sytem restart to apply changes. Does anybody know how I can apply these changes to the Control Panel immediately, without requiring a system restart? Can anybody can help me?

        RegistryKey RegKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
        RegKey.SetValue("NoControlPanel", true, RegistryValueKind.DWord); RegKey.Close();

        RegKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
        RegKey.SetValue("NoControlPanel", true, RegistryValueKind.DWord); RegKey.Close();

        //registry
        RegKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\
        Group Policy Objects\LocalUser\Software\Microsoft\Windows\CurrentVersion\Policies\System");
        RegKey.SetValue("DisableRegistryTools", true, RegistryValueKind.DWord); RegKey.Close();

        RegKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
        RegKey.SetValue("DisableRegistryTools", true, RegistryValueKind.DWord); RegKey.Close();
        return true;
A: 

You could try to run Gpupdate after you made the registry changes. This should in theory reload the group policy details and therefore disable the control panel.

tomlog
thanks for ur response, Gpupdate wont work gpedit /Target:User /force gpedit /Target:computer /forceany other method
JKS
is any other method to update changes immediately
JKS