How to change HKCU registry as the admin
-
I want to create a string value DisableLockWorkStation under the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System. The user is not allowed to do it. (I want to do it for NT4, Win2k, and XP). The manual way is to login as the administrator, run regedt32, and load the registry hive ntuser.dat file of the user from Documnents and Settings under HKEY_USERS. Afterwards create the new value and unload the hive. But then the administrator should repeat it for every user. How can the administrator do a change that affects every user? I tried creating the value in the relevant key in [HKEY_USERS\.DEFAULT]. It didn't affect either the user or the administrator. Actually I want to do this during the installation of my program. So the solution has to be convertible to C++ for me. Thank you...
-
I want to create a string value DisableLockWorkStation under the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System. The user is not allowed to do it. (I want to do it for NT4, Win2k, and XP). The manual way is to login as the administrator, run regedt32, and load the registry hive ntuser.dat file of the user from Documnents and Settings under HKEY_USERS. Afterwards create the new value and unload the hive. But then the administrator should repeat it for every user. How can the administrator do a change that affects every user? I tried creating the value in the relevant key in [HKEY_USERS\.DEFAULT]. It didn't affect either the user or the administrator. Actually I want to do this during the installation of my program. So the solution has to be convertible to C++ for me. Thank you...
The way to edit this is to use Group Policy. See this page[^] for details (Google's cache of a page on microsoft.com). I'd recommend asking the administrator to do this. If you're in an Active Directory network environment the administrator can do this by creating a Group Policy object with the setting; place all the computers you want the setting to affect in the same Organizational Unit in AD, and link the GPO to that container. If you want a global policy for your organisation, create the GPO in the domain root. If you must do it on a local system through code, you can use the
IGroupPolicyObject
interface to edit the local GPO. Stability. What an interesting concept. -- Chris Maunder