How to fix a Win10 system bricked by changing a Group Policy
Scenario:
Change a Group Policy and it bricks the system
"Restore from System Restore Point" fails or there are no recent restore points
Challenge:
There is no access to the GUI Group Policy Editor from the command prompt of a bricked system
Recovery Method:
Use command line tools to restore the group policy to its original form
Example:
This example uses the Group Policy "Virtualization Based Protection of Code Integrity", which works OK when enabled on a Dell Latitude E7440 using a Samsung 850 Pro but bricks a Dell Latitude 7490 using a Samsung 960 Pro M.2 NVMe SSD and the Samsung NVMe driver
The path in the Group Policy Editor to this policy is:
Group Policy Management Console -> Computer Configuration -> Administrative Templates -> System -> Device Guard -> Turn On Virtualization Based Security
Steps to fix a Win10 system bricked by enabling Group Policy "Virtualization Based Protection of Code Integrity" - registry key "HypervisorEnforcedCodeIntegrity":
.
.
*** Using a working system: ***
-
Download the Microsoft Security Compliance Toolkit 1.0 : https://www.microsoft.com/en-us/download/confirmation.aspx?id=55319
-
Unzip the LGPO.zip file
-
Copy the LGPO.exe utility to the root directory of a USB flash drive, e.g. D:, E:\
-
Release and remove the USB flash drive
.
.
.
*** On the bricked system: *** -
Insert the USB drive
-
Turn on the bricked system
-
Using the "automatic recovery" menu options of the failed boot or a system recovery USB/DVD, open a Command Prompt:
Troubleshoot -> Advanced Options -> Command Prompt
-
cd to the root directory of the USB drive (you may need to attempt several drives to discover it, depending on your system, e.g. cd D:, cd E:, cd F:, etc.)
Example:
Run the command:cd e:\
-
Copy the "Registry.pol" file to the root directory of the USB flash drive
Copy from:
C:\Windows\System32\GroupPolicy\Machine\Registry.pol
to
the root directory of the USB drive, e.g. E:\
Example:
Run the command:copy C:\Windows\System32\GroupPolicy\Machine\Registry.pol E:\
-
exit the Command Prompt:
Run the command:exit
-
Using the menu option, select "Turn off your PC"
-
When the sytem has powered off, remove the USB flash drive
.
.
.
*** On the working system: *** -
Put USB flash drive into the working system
-
Using File Explorer, rename the Registry.pol file to: registry-policy-initial-state.pol
-
Open a Command Prompt
-
cd to the root directory of the USB flash drive, e.g. D:, E:, F:\
-
Extract the Group Policies into an LGPO text file:
Run the command:LGPO /parse /q /m .\registry-policy-initial-state.pol > registry-policy-initial-state-lgpo.txt
-
On the USB flash drive, open the registry-policy-initial-state-lgpo.txt file in a text editor
-
Using a text editor, replace the "HypervisorEnforcedCodeIntegrity" entry with the following contents:
Old text:
Computer
SOFTWARE\Policies\Microsoft\Windows\DeviceGuard
HypervisorEnforcedCodeIntegrity
DWORD:1
New text:
; disable "Virtualization Based Protection of Code Integrity"
Computer
SOFTWARE\Policies\Microsoft\Windows\DeviceGuard
HypervisorEnforcedCodeIntegrity
DWORD:0
; deselect "Require UEFI Memory Attribute Table"
Computer
SOFTWARE\Policies\Microsoft\Windows\DeviceGuard
HVCIMATRequired
DWORD:0
-
Save the file onto the root directory of the USB flash drive as:
registry-policy-changed-state-lgpo.txt
-
Using the Command Prompt, create a fixed policy file
Run the command:LGPO.exe /r .\registry-policy-changed-state-lgpo.txt /w .\Registry.pol
-
Release and remove the USB flash drive from the working system
.
.
.
*** On the bricked system: *** -
Put the USB flash drive into the bricked system
-
Turn on the bricked system
-
Using the "automatic recovery" of the failed boot or a system recovery USB/DVD, open a command prompt:
Troubleshoot -> Advanced Options -> Command Prompt
-
cd to the root directory of the USB drive (you may need to attempt several drives to discover it, depending on your system, e.g. cd D:, cd E:, cd F:, etc.)
Example:
Run the command:cd e:\
-
Copy the fixed "Registry.pol" policy file to the bricked system
Copy from:
the root directory of the USB flash drive, e.g. D:, E:,
To
C:\Windows\System32\GroupPolicy\Machine\Registry.pol
Example:
Run the command:copy E:\Registry.pol C:\Windows\System32\GroupPolicy\Machine\Registry.pol
-
exit the Command Prompt:
Run the command:exit
-
Using the menu option, select "Exit and continue to Windows 10"
The system should boot normally