Scripts (PowerShell)

Unable to import reg file or create a registry key: The specified file is not a registry script


The Registry Editor is an advanced tool for viewing and modifying settings in the registry. This information contains information about how your computer runs etc. Windows stores its configuration information in a database called the registry and this is organized in a tree format. Although Registry Editor enables you to inspect and modify the registry, normally you do not need to do so, and making incorrect changes can break your system. An advanced user who is prepared to both edit and restore the registry can safely use Registry Editor for such tasks as eliminating duplicate entries or deleting entries for programs that have been uninstalled or deleted. See the following hyperlinks for some Windows Registry contents I have written. What is Registry Editor and how to access the registry hives, and how to search through the Windows registry? You can view and find system information via the Windows registry. To view System Information using the MSINFO32 and Systeminfo switch, and how to enable or disable TLS 1.2 on a Windows Server via the Registry and PowerShell.

Registration Entries (.reg) file is used to add, modify, or delete registry entries. The Registry Editor (regedit.exe) uses .reg files to import and export registry subkeys and values. You can use these .reg files to distribute registry changes to several Windows-based computers. When you run a .reg file, the file contents merge into the local registry.

As you can see from the image below, when you try to run a registry file (.reg) either by double-clicking it or via PowerShell, the following might be prompted. This guide will instruct you on how to fix this issue.


As you can see in the file below, the registry version number is missing and it is also not properly indented. To fix the .reg file issue, ensure it is properly formatted as shown in the steps below.


Solution: A “.reg” file has the following syntax as shown below and it must be followed else it will not work. PLEASE pay attention to the sample script on how it is outlined (indented). The RegistryEditorVersion is either Windows Registry Editor Version 5.00 for Windows 2000 and higher systems or REGEDIT4 for Windows 98 and Windows NT 4.0.
– Note that the REGEDIT4 header also works on Windows 2000 and higher computers, including Windows 10

Blank line
Blank line

The first (1st) line should start with the registry editor version. This is the basic rule. Here is a similar guide on “how to target WSUS clients with the registry keys“. Open (edit) the .reg file using Notepad.
– Enter the version number (ensure registry editor version is entered as shown below).
– Leave a blank space
– Enter the reg key syntax as shown below.


That should fix the error and as you can see, I was able to add the registry keys. See how to enable or disable TLS 1.2 on a Windows Server via the Registry and PowerShell for more information.


I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x