- OpenVPN IPv6 and IPv4 configuration - Mon, Mar 1 2021
- 4sysops author and member competition 2020 - Fri, Jan 1 2021
- Assign an IPv6 address to an EC2 instance (dual stack) - Tue, Dec 15 2020
The Windows Registry editor allows you to export a Registry key into a REG file. Unfortunately, you can’t just import the REG file into Group Policy Preferences; the Group Policy Editor only accepts XML files. Fortunately, Malcolm McCaffery wrote a PowerShell script that converts REG to XML.
Export REG file ^
To export a Registry key, launch the Registry editor (type regedit on the Start Screen), right-click the key, and then select Export from the context menu. The Registry editor will then prompt you to specify a file name for your REG file.
Export Registry key to REG file
Convert REG to XML ^
Malcolm’s PowerShell script to convert REG to XML contains a little bug that prevents the script from accepting input parameters. The author probably uploaded a version he used for testing. I modified the script, so you can use it right away. You can download the modified script here. If you just launch RegToXML.ps1, it will ask for the name of the REG and XML files. You can specify the input parameters like this:
.\RegToXML.ps1 c:\path\input.reg c:\path\output.xml
If the conversion is successful, you should see the XML output in the PowerShell console.
RegToXML supports the common Registry types:
Import into Group Policy Preferences ^
Importing the converted Registry path into Group Policy Preferences is simple, too, although not self-evident. You have to right-click the XML file in File Explorer and then copy it to the Windows clipboard.
Copy XML file to clipboard
Now, in the Group Policy Editor, navigate to User Configuration (or Computer Configuration) > Preferences > Windows Settings > Registry and right-click the white pane on the right. In the context menu, select Paste.
Import Registry key into Group Policy Preferences
The Group Policy Editor will insist that you confirm the import.
If the Group Policy Editor doesn’t like your XML file, you will get an error message.
The pasted document is invalid and will be ignored.
I know it is hard to be ignored. The only thing you can do now is try it again. Perhaps you just copied the wrong file. It is also possible that something went wrong during the REG to XML conversion.
You can also first create a folder and then paste the XML file. Right-click the Registry symbol, navigate to New, and then select Collection Item.
If the Group Policy Editor considers you worthy enough not to be ignored, after you paste the XML file you will see your Registry key with the complete folder structure of the Registry hive. You can then navigate to the keys to see whether the values are okay.
Imported Registry key
Notice that this method of deploying Registry settings with Group Policy Preferences is only something for absolute Registry geeks. The Registry settings can vary on different machine types with different configurations. Thus, you really have to understand what you are doing here.
If you are a Windows Taskbar expert, you have probably already noticed what Registry key I imported here. The Taskband key contains all the settings for the apps that you pinned to the Taskbar. However, deploying these Registry settings with Group Policy is not enough to configure the Taskbar properly. In one of my next posts, I will cover this topic in more detail.