I need to import a .reg file that contains the standard configuration settings for the server product. However, it is possible that there may be several server instances in a single Windows window. Each server instance has its own configuration keys in the Windows registry.
The first instance will have a default registry key:
HKLM\SOFTWARE\<Vendor>\<Product>\Settings
Any other instances will have variant names, for example:
HKLM\SOFTWARE\<Vendor>\<Product>\Settings-foo
HKLM\SOFTWARE\<Vendor>\<Product>\Settings-bar
HKLM\SOFTWARE\<Vendor>\<Product>\Settings-baz
etc...
The registry file contains parameters that must be applied to each of these server instances. The structure of the registry subcategories is the same in every key. So, the manual deployment process is to take the .reg file and search and replace the file for "SOFTWARE\<Vendor>\<Product>\Settings\"and replace it with "SOFTWARE\<Vendor>\<Product>\Settings-foo\", and then import the newly modified .reg file. Rinse and repeat for bar, baz, etc.
What I want to do is write a PowerShell script that receives a list of all the "Settings" keys and performs the equivalent search and replace operation before importing the .reg file. I did not find a cmdlet that can import REG files, so I think I need to call reg.exe or regedit.exe. Both of these programs allow you to import the contents of a .reg file to disk.
: REG , reg.exe /Import <filename> regedit.exe /S <filename>? .reg , reg.exe regedit.exe .reg ?