Set a registry key for the default user template

From The IT Community
Jump to: navigation, search




If you want to set a registry key in HKEY_CURRENT_USER for all users, you can do this with GPO, or by writing a batch file which runs at startup and checks the registry for every user.

But there is also an other way (for new users).


If, for example, you want to set a key that looks as follow:

Key:  HKCU\Software\SAP\General
Name: Language
Value: EN  (REG_SZ)


Then the solution would look like this:


  • Registry key (called SAP.reg):
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\temp\Software\SAP\General]
"Language"="EN"


  • And the commands (which you can put into a batch file of course):
reg load HKLM\temp c:\users\default\ntuser.dat
reg import %~dp0SAP.reg
reg unload HKLM\temp


What happens here is that you mount the registry of the default user into HKLM\temp, import the registry file from above (which writes the value into the now mounted registry tree) and unmount it again.

Now when a new user logs in, he gets a copy of the registry of the default user and has the key set in his own tree. :-)



Was this article helpful? Then please donate to keep The IT Community alive...

If you found this article helpful please share it, comment and help others by writing your own article.






Translate this page:




Articles found in the same category:
(max. 20 shown)