Registry Imports

Looking for the easiest/best way to import registry values *.reg for Local Machine and for Current User via the Toolkit when deployed with SCCM. I have found the Set-RegistryKey command but there are a ton of keys and would prefer to import a while .reg file. If reg.exe import is the best route for this what is the syntax to run this via the toolkit. I am not having any luck.

try this. Put the .reg file into the Files folder.
Then add this line:

execute-process “regedit.exe /s $dirFiles\regfile.reg”

where regfile.reg is the name of your exported reg keys.

Didn’t work. Do I need the $dirFiles variable if it is the root of the Files folder? Here is the command:
execute-process “regedit.exe /s $dirFiles\LM InterwovenSettings 32bit.reg”

What I did to facilitate this was the following:

`execute-process -path “$envSystemRoot\Regedit.exe” -Parameters “/import $dirFiles\file.reg /reg:64” -windowStyle Hidden

Let me know if this helps you.

What account are you executing your installation with? The Current User Hive is, as the name suggest, the personal hive of the user account running a process. Meaning if you execute Deploy-Application.exe or powershell.exe as any other than the user account logged on to the interactive Windows session the Current User registry hive will be the one belonging to that account and not the User Hive of the logged in user…

You could either utilize the function Execute-ProcessAsUser or look at the function Invoke-HKCURegistrySettingsForAllUsers.

I would suggest that you “translate” your reg file into your script and use the latter function as this would place the keys and values under all current and future users personal registry hive on the system.

If you don’t mind sharing your reg file (or parts of it), you would most likely get better help.

Here’s the example from the documentation:

<code>[scriptblock]$HKCURegistrySettings = {
Set-RegistryKey -Key &#039;HKCU\Software\Microsoft\Office\14.0\Common&#039; -Name &#039;qmenable&#039; -Value 0 -Type DWord -SID $UserProfile.SID
Set-RegistryKey -Key &#039;HKCU\Software\Microsoft\Office\14.0\Common&#039; -Name &#039;updatereliabilitydata&#039; -Value 1 -Type DWord -SID $UserProfile.SID
}
Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings</code>

Edit: Re-read your post and understand you have a lot of registry entries to import… I would probably look into using a text editor such as Notepad++ to figure out a way to translate the reg-file into the function suggested earlier… or maybe split it up into one “HKU reg file” and one “HKLM reg file” and utilize execute-processasuser if you’re planning on doing a interactive deployment… It’s all depending on the scenario and how you choose to deploy your installation.

This is quite a random coincidence I just stumbled upon… Have a look at second post in this thread:
http://psappdeploytoolkit.com/forums/topic/adobe-reader-dc-with-registry-settings-for-all-users-silent-install/#post-374

I have a powershell module (.dll) made in c#, with cmdlets to convert .reg files to PSAPPDEPLOYTool cmdlets. if anybody would like to try it, here you are :)

https://drive.google.com/open?id=0B9d-QGIouqlwfkRKTTZSUmdwUXpkSlBuUFB5Vm5Dc1QzSEctN2dxWnR1RXFMejNmcWgyRWM

Might be interesting for you :)…