|
| 1 | +--- |
| 2 | +title: Azure virtual machine is unresponsive while applying policy |
| 3 | +description: This article provides steps to resolve issues in which the load screen is stuck when applying a policy during boot in an Azure VM. |
| 4 | +services: virtual-machines-windows |
| 5 | +documentationcenter: '' |
| 6 | +author: TobyTu |
| 7 | +manager: dcscontentpm |
| 8 | +editor: '' |
| 9 | +tags: azure-resource-manager |
| 10 | +ms.assetid: a97393c3-351d-4324-867d-9329e31b5628 |
| 11 | +ms.service: virtual-machines-windows |
| 12 | +ms.workload: infrastructure-services |
| 13 | +ms.tgt_pltfrm: na |
| 14 | +ms.topic: troubleshooting |
| 15 | +ms.date: 05/07/2020 |
| 16 | +ms.author: v-mibufo |
| 17 | +--- |
| 18 | + |
| 19 | +# VM becomes unresponsive while applying ‘Group Policy Local Users & Groups’ policy |
| 20 | + |
| 21 | +This article provides steps to resolve issues where the load screen is stuck when applying a policy during boot in an Azure VM. |
| 22 | + |
| 23 | +## Symptoms |
| 24 | + |
| 25 | +When using [Boot diagnostics](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/boot-diagnostics) to view a screenshot of the VM, the screen is stuck loading with the message: ‘*Applying Group Policy Local Users and Groups policy*’. |
| 26 | + |
| 27 | +:::image type="content" source="media//unresponsive-vm-apply-group-policy/applying-group-policy-1.png" alt-text="Screenshot of Applying Group Policy Local Users and Groups policy loading (Windows Server 2012 R2)."::: |
| 28 | + |
| 29 | +:::image type="content" source="media/unresponsive-vm-apply-group-policy/applying-group-policy-2.png" alt-text="Screenshot of Applying Group Policy Local Users and Groups policy loading (Windows Server 2012)."::: |
| 30 | + |
| 31 | +## Cause |
| 32 | + |
| 33 | +There are conflicting locks when the policy attempts to cleanup old user profiles. |
| 34 | + |
| 35 | +> [!NOTE] |
| 36 | +> This applies only to Windows Server 2012 and Windows Server 2012 R2. |
| 37 | +
|
| 38 | +Here’s the problematic policy: |
| 39 | + |
| 40 | +`Computer Configuration\Policies\Administrative Templates\System/User Profiles\Delete user profiles older than a specified number of days on system restart` |
| 41 | + |
| 42 | +## Resolution |
| 43 | + |
| 44 | +### Process overview |
| 45 | + |
| 46 | +1. [Create and access a repair VM](#step-1-create-and-access-a-repair-vm) |
| 47 | +2. [Disable the policy](#step-2-disable-the-policy) |
| 48 | +3. [Enable Serial Console and memory dump collection](#step-3-enable-serial-console-and-memory-dump-collection) |
| 49 | +4. [Rebuild the VM](#step-4-rebuild-the-vm) |
| 50 | + |
| 51 | +> [!NOTE] |
| 52 | +> If your encounter this boot error, the Guest OS isn’t operational. You must troubleshoot in Offline mode. |
| 53 | +
|
| 54 | +### Step 1: Create and access a repair VM |
| 55 | + |
| 56 | +1. Use [steps 1-3 of the VM repair commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to prepare a repair VM. |
| 57 | +2. Use Remote Desktop Connection connect to the repair VM. |
| 58 | + |
| 59 | +### Step 2: Disable the policy |
| 60 | + |
| 61 | +1. On the repair VM, open the Registry Editor. |
| 62 | +2. Locate the key **HKEY_LOCAL_MACHINE** and select **File** > **Load Hive...** from the menu. |
| 63 | + |
| 64 | + :::image type="content" source="media/unresponsive-vm-apply-group-policy/registry.png" alt-text="Screenshot shows highlighted HKEY_LOCAL_MACHINE and the menu containing Load Hive."::: |
| 65 | + |
| 66 | + - Load Hive allows you to load registry keys from an offline system, in this case the broken disk attached to the repair VM. |
| 67 | + - System-wide settings are stored on `HKEY_LOCAL_MACHINE` and can be abbreviated as “HKLM”. |
| 68 | +3. In the attached disk, go to the `\windows\system32\config\SOFTWARE` file and open it. |
| 69 | + |
| 70 | + 1. You will be prompted for a name. Enter BROKENSOFTWARE.<br/> |
| 71 | + 2. To verify that BROKENSOFTWARE was loaded, expand **HKEY_LOCAL_MACHINE** and look for the added BROKENSOFTWARE key. |
| 72 | +4. Navigate to BROKENSOFTWARE and check if the CleanupProfile key exists in the loaded hive. |
| 73 | + |
| 74 | + 1. If the key exists, then the CleanupProfile policy is set, its value represents the retention policy in days. Continue deleting the key.<br/> |
| 75 | + 2. If the key doesn't exist, the CleanupProfile policy isn't set. [Submit a support ticket](https://portal.azure.com/?#blade/Microsoft_Azure_Support/HelpAndSupportBlade), including the memory.dmp file located in the Windows directory of the attached OS disk. |
| 76 | + |
| 77 | +5. Delete the CleanupProfiles key using this command: |
| 78 | + |
| 79 | + ``` |
| 80 | + reg delete "HKLM\BROKENSOFTWARE\Policies\Microsoft\Windows\System" /v CleanupProfiles /f |
| 81 | + ``` |
| 82 | +6. Unload the BROKENSOFTWARE hive using this command: |
| 83 | +
|
| 84 | + ``` |
| 85 | + reg unload HKLM\BROKENSOFTWARE |
| 86 | + ``` |
| 87 | +
|
| 88 | +### Step 3: Enable Serial Console and memory dump collection |
| 89 | +
|
| 90 | +To enable memory dump collection and Serial Console, run this script: |
| 91 | +
|
| 92 | +1. Open an elevated command prompt session (Run as administrator). |
| 93 | +2. Run these commands: |
| 94 | +
|
| 95 | + **Enable Serial Console**: |
| 96 | + |
| 97 | + ``` |
| 98 | + bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /ems {<BOOT LOADER IDENTIFIER>} ON |
| 99 | + ``` |
| 100 | +
|
| 101 | + ``` |
| 102 | + bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200 |
| 103 | + ``` |
| 104 | +3. Verify if the free space on the OS disk is at least equal to the VM’s memory size (RAM). |
| 105 | +
|
| 106 | + If there isn’t enough space on the OS disk, change the memory dump location and refer it to an attached data disk with enough free space. To change the location, replace “%SystemRoot%” with the drive letter (e.g. “F:”) of the data disk in the commands below. |
| 107 | +
|
| 108 | + **Suggested configuration to enable OS dump**: |
| 109 | +
|
| 110 | + Load Broken OS Disk: |
| 111 | +
|
| 112 | + ``` |
| 113 | + REG LOAD HKLM\BROKENSYSTEM <VOLUME LETTER OF BROKEN OS DISK>:\windows\system32\config\SYSTEM |
| 114 | + ``` |
| 115 | +
|
| 116 | + Enable on ControlSet001: |
| 117 | + |
| 118 | + ``` |
| 119 | + REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f |
| 120 | + REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f |
| 121 | + REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f |
| 122 | + ``` |
| 123 | +
|
| 124 | + Enable on ControlSet002: |
| 125 | + |
| 126 | + ``` |
| 127 | + REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f |
| 128 | + REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f |
| 129 | + REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f |
| 130 | + ``` |
| 131 | + |
| 132 | + Unload broken OS disk: |
| 133 | + |
| 134 | + ``` |
| 135 | + REG UNLOAD HKLM\BROKENSYSTEM |
| 136 | + ``` |
| 137 | +
|
| 138 | +### Step 4: Rebuild the VM |
| 139 | +
|
| 140 | +Use [step 5 of the VM Repair Commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to reassemble the VM. |
| 141 | +
|
| 142 | +If the issue is fixed, the policy has been disabled locally. For a permanent solution, don’t use CleanupProfiles policy on VMs. Use a different method to perform profile cleanups. |
| 143 | +
|
| 144 | +Don’t use this policy: |
| 145 | +
|
| 146 | +`Machine\Admin Templates\System\User Profiles\Delete user profiles older than a specified number of days on system restart` |
| 147 | +
|
| 148 | +## Next steps |
| 149 | +
|
| 150 | +If you encounter issues when you apply Windows Update, see [VM is unresponsive with "C01A001D" error when applying Windows Update](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/unresponsive-vm-apply-windows-update). |
0 commit comments