I took original from the .EXAMPLE in the Set-ActiveSetup. I will have to ask the Developers to update it.

The catch is that your REG file can only have entries for HKEY_CURRENT_USER. If you have HKEY_LOCAL_MACHINE entries in your REG file, they must be separated and imported during the install of the program.

So:
Set-RegistryKey–> Set registry but not from a reg file.
Set-ActiveSetup–> To use a .reg file and then set on HKCU from active setup
Invoke-HKCURegistrySettingsForAllUsers –> To set HKCU from HKU hive and will set default user as already create user and future user. But does not support .reg file. This one would be insteresting by just reading . reg file and set the value.

None support .reg files directly and there is no converter at this time.

Set-RegistryKey affects one registry value at a time. In your case, if you have HKEY_LOCAL_MACHINE entries in your REG file, you must use this at install time.

ActiveSetup is a built-in feature of Windows that triggers an EXE to make per-user changes when a user logs in. The EXE is triggered ONCE and delays the showing of the desktop until it is done or fails. If it fail you will get no error message. If the EXE hangs or takes a long time to finish, you will think your computer is hung. Set-ActiveSetup creates the required registry keys in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components” to make ActiveSetup to work. When a user logs in, the OS reads those sub-keys and creates a matching key name in “HKEY_CURRENT_USER\SOFTWARE\Microsoft\Active Setup\Installed Components”.

In your case, that EXE is REG.exe and you give reg.exe parameters. Just make sure that a regular user has the permissions to make those changes. The EXE file (and reg file in your case) must be reachable when the user logs in. If the regular user cannot run/read the file, it will fail. So a more complete code sample would be:

Invoke-HKCURegistrySettingsForAllUsers take a more aggressive way of doing per-user changes. It locates all NTUSER.DAT files (Each user’s HKCU) and forces the changes in at install time. For future users, it modifies the Default user profile. I don’t like this route because I see it as pollutes the Default user profile. You could, in theory, make a change that makes new user profiles unusable.

The PSAppDeploymentToolkitAdminGuide.docx does mention some of this but it assumes you know what ActiveSetup is and how it works.

The downside of reg.exe or regedit is the UAC. When we are running regedit or reg there is a command window appearing and it takes a time before running. It will but it takes time. So there is a possibility a user would just close the window.

Yes, I know Active setup. Personnally, I believe all whose scenarios are usefull.

1. When configuring a new computer Invoke-HKCURegistrySettingsForAllUsers will make ready a computer for everyone for HKCU.
2. Set-RegistryKey is good for new computers and for change during software installation
3. Set-ActiveSetup is usefull to configure diverses user components. But the UAC might be a problem while changing HKCU with reg.exe or regedit as it might takes time. Is it a way to make it run minimize or hidden?