Hi,
I have a .reg file with many values. How should I script it to take the different key and values and pushing it to the default profile?
THanks,
Hi,
I have a .reg file with many values. How should I script it to take the different key and values and pushing it to the default profile?
THanks,
That great for NEW users on the machines. What about existing users?
Consider using Set-ActiveSetup
If all the REG changes go to HKCU you should be able to something like this:
Set-ActiveSetup -StubExePath "$envWinDir\regedit.exe" -Arguments "/S <code>"%SystemDrive%\Program Files (x86)\PS App Deploy\PSAppDeployHKCUSettings.reg</code>"" -Description 'PS App Deploy Config' -Key 'PS_App_Deploy_Config' -ContinueOnError $true
Hi,
With regedit /s …reg there is an annoying window from the Windows security will set-activesetup doing better?
Thanks,
Sorry, I meant something like this:
Set-ActiveSetup -StubExePath “$envSystem32Directory\reg.exe” -Arguments “import "%SystemDrive%\Program Files (x86)\PS App Deploy\PSAppDeployHKCUSettings.reg“” -Description ‘PS App Deploy Config’ -Key ‘PS_App_Deploy_Config’ -ContinueOnError $true
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.
Hi,
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.
Thanks,
François
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:
<code>#Copy the REG file on the machine Copy-File -Path "$dirFiles\PSAppDeployHKCUSettings.reg" -Destination "$envProgramFilesX86\PS App Deploy\PSAppDeployHKCUSettings.reg" -ContinueOnError $false #prepare ActiveSetup Set-ActiveSetup -StubExePath "$envSystem32Directory\reg.exe" -Arguments "import <code>&quot;$envProgramFilesX86\PS App Deploy\PSAppDeployHKCUSettings.reg</code>"" -Description 'PS App Deploy Config' -Key 'PS_App_Deploy_Config' -ContinueOnError $true</code>
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.
Hi,
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.
Thanks,
I can’t reproduce the UAC prompt with reg.exe import <path to .reg file>
I tried on 3 computers in 3 different environments.
In one of our environments REG/Regedit is disabled for normal users but no UAC prompt.
So we usually launch a WiseScript exe that does registry the changes.
I’m sorry. I can’t help you.
You must find a way that a regular user can change their HKCU and use that in ActiveSetup.
I did found this though:
Hi,
With Active Setup it will work… but a window is appearing and after a time the job will be done but before that, if you click on the Window, the prompt will appear.
Wise? Who is still using Wise?
Thanks,