Apply registry tweak to newly created users

7

2

Assume I have made "This PC" show up on my desktop with this registry tweak:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000

And now I want to make this a kind of "system default" that applies to all users that's created after my modification, while leaving existing users unaffected. How can I achieve that?

I have looked at HKEY_USER\.DEFAULT but that looks a bit strange and I'm afraid it's not the right place to apply my tweaks.

iBug

Posted 2018-01-14T09:42:59.843

Reputation: 5 254

Answers

11

How can I apply a registry tweak to new users?

You need to apply your tweak to HKEY_USERS in %SystemDrive%\Users\Default\NTUSER.DAT. This has to be done by loading the registry hive.

Any settings changed in the loaded hive will be copied to every new user profile that is created.

Full instructions below.

Note:

To make sure every new profile created on a machine gets specific user settings we will need to change the registry settings that are used to build all new profiles. The trick is first to understand where these default settings come from. Then when we know where they come from we need to be able to edit them and save them. Once that is done all new profiles will be created with whatever settings we want.

The location of where new profiles copy their user registry settings is located on the file system at %SystemDrive%\Users\Default\NTUSER.DAT in Windows 7 and Windows Vista, in Windows XP it is located at %SystemDrive%\Documents and Settings\Default User\NTUSER.DAT. Now that we know what file is copied to create all new profile user registry settings we just need a way to edit the settings. Well there’s a tool for that, it’s called Regedit.exe.

The trick with editing the default user profile registry settings is to first know that it is not available in Regedit.exe by default. We will need to load the NTUSER.DAT file into Regedit.exe to be able to edit the settings. Open Regedit.exe by going to Start and typing Regedit, then right-click the search result and select Run as administrator. If you are currently logged on with a non-administrator the User Account Control box will allow you to provide administrative credentials, otherwise click Yes in the UAC box.

When Regedit starts, navigate to HKEY_USERS and left click it.

enter image description here

Go to the menu and select File->Load Hive. For more information on loading Windows Registry hives; http://technet.microsoft.com/en-us/library/cc732157.aspx.

enter image description here

Browse to the NTUSER.DAT file based on which Windows version you are using and Open it. You will have to have, ‘show hidden and system files’ enabled in the folder options control panel. For more information; http://windows.microsoft.com/en-US/windows7/Show-hidden-files.

enter image description here

Give the hive a name, it does not matter what name you give it. Here I used Default Profile, but it could have been anything.

enter image description here

In Regedit, browse to HKEY_USERS->whatever hive name you gave. You now be able to edit the default user profile registry settings. Remember to back them up first before editing

enter image description here

When finished, go to the menu File->Unload Hive.

enter image description here

That’s it! Any settings you change in the loaded hive will be copied to every new user profile that is created on that machine.

Source Tip 49: How Do You Set Default User Profile Registry Settings


So what is HKU.DEFAULT if it's not the default user?

It's actually the profile for the Local System account and is an alias for HKEY_USERS\S-1-5-18:

Despite its name, the profile for the .Default user is not the default user profile. It's actually the profile for the Local System account and is an alias for HKEY_USERS\S-1-5-18. (S-1-5-18 is the security identifier for the Local System account.) Consequently, settings in HKEY_USERS.Default are used by programs and services that run as Local System. The most visible examples of programs that run as Local System are winlogon and logonui, the programs that display the interface for logging onto the system. Whatever color scheme and screen saver you choose for the Local System profile get used at the logon screen.

...

The registry settings for new users do not come from the .Default user. Rather, they come from what I've started calling the "template user", which is kept† in the file C:\Documents and Settings\Default User\ntuser.dat. This hive is not loaded most of the time (since there's no reason to waste memory on something that is needed only rarely), so if you want to make a change to the template user, you'll have to load the hive manually.

Mind you, messing with the template user hive directly is most likely not supported. The supported way of modifying the template user hive on Windows XP is to use the system preparation tool "SysPrep". Boot into factory mode, make your customizations to the current user, then reseal. The resealing process propagates the current user's settings to the template user (or, more specifically, the ones that can safely be propagated to the template user—you don't want to propagate things like encryption keys) before "resealing" the system for deployment.

Source The .Default user is not the default user

DavidPostill

Posted 2018-01-14T09:42:59.843

Reputation: 118 938

1Hmmm, I didn't realize that SysPrep does all the things for me. However when I set "Show This PC on desktop" in Control Panel (which actually sets HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\{20D04FE0-3AEA-1069-A2D8-08002B30309D} to DWORD 0) and then use SysPrep to seal it, the setting doesn't seem to be applied to new users when I later install that system with my tweaks. – iBug – 2018-01-14T11:43:46.603

@iBug Don't know anything about sysprep - I've never used it :( – DavidPostill – 2018-01-14T11:44:46.803