Difference between revisions of "Changing default user settings"

From DanIT
Jump to navigation Jump to search
(Created page with "=Registry= When you know the registry key(s) that you want changed, you might also want to set these for the 'default' user profile.<br> New users will automatically get these...")
 
 
Line 26: Line 26:
 
  ERROR: Access is denied.
 
  ERROR: Access is denied.
 
Make sure that you do not have a regedit (Registry Editor) open that has this hive or any subkeys in it selected.<br>
 
Make sure that you do not have a regedit (Registry Editor) open that has this hive or any subkeys in it selected.<br>
Also make sure that you do not have any prompts or scripts running that have an open request into this hive, without properly closing them.
+
Also make sure that you do not have any apps consoles or scripts running that have an open request into this hive, without properly closing them.

Latest revision as of 01:34, 10 February 2022

Registry

When you know the registry key(s) that you want changed, you might also want to set these for the 'default' user profile.
New users will automatically get these settings without having to manually set them, run scripts, or policies each time.
The user can change the default settings afterwards at any time, and will not be reset to default values.

You might come across the "HKEY_USERS\.DEFAULT" registry hive, however, changing registry settings here will not work.
This is because Windows loads the Default User profile hive on bootup, but never unloads them, and thus it will never save your changes.
Manually unloading the hive ("reg.exe unload HKU\.DEFAULT") will not work, because the hive is always in use by some Windows process.

The only solution to this, is to load the Default User profile hive into a different key, editing something in the hive, and then unloading it when done.
For example (in PowerShell):

Start-Process -FilePath 'reg.exe' -ArgumentList 'load HKU\<DefaultUser> "C:\Users\Default\NTUSER.DAT"' -Wait

New-ItemProperty -Path 'HKU:\<DefaultUser>\SOFTWARE\Microsoft\Windows\CurrentVersion\Example' -Name 'Test123' -PropertyType DWord -Value 0

Start-Process -FilePath 'reg.exe' -ArgumentList 'unload HKU\<DefaultUser>' -Wait

By default in PowerShell, the HKEY_USERS registry hive has not been binded, in order to access "HKU:\" you need to do this first:

New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS

Error

ERROR: Access is denied.

Make sure that you do not have a regedit (Registry Editor) open that has this hive or any subkeys in it selected.
Also make sure that you do not have any apps consoles or scripts running that have an open request into this hive, without properly closing them.