My goal is to import specific registry program settings (e.g. CCleaner) into the Default user profile of an active system to make sure new users get a predefined configuration. I do not want to create a new installation image or use any commercial third party software.
This is how to import a .reg file to another user's profile:
runas /u:User "cmd.exe /k reg import C:\Test.reg"
I adapted it to:
runas /u:DefaultAccount "cmd.exe /k reg import C:\Test.reg"
Error:
1327: Logon failure: user account restriction. Possible reasons are
blank passwords not allowed, logon hour restrictions, or a policy
restriction has been enforced.
So I changed the following Registry value to:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"LimitBlankPasswordUse"=dword:00000000
But there is still the same error although it works with any other User!
So how to import a .reg file into the Default user profile via command line?
Best Answer
You need to mount the DEFAULT user profile first:
Then you can import or add your settings to the newly created HKLM\DEFAULT branch: (It's really important your path in
reg add
doesn't have a trailing slash\
)In your case, you can import a .reg file also - but you need to make sure you edit the .reg so that the paths are correct for your mount point:
When you are done, unmount the DEFAULT registry hive:
Here is an example of a complete script I use to customize newly imaged Windows 10 computers, now that the 'CopyProfile' unattend.xml setting no longer works reliably. I couple this with other scripts, as well as a Windows 10 Provisioning Package.