Windows Server 2016 on Hyper-V stuck at stopping

When a Windows Server 2016 guest VM on Hyper-V hangs while stopping after Windows Updates, and it won't reboot, it might be caused by the recovery debug information type set. Here is some additional information.
Published on Wednesday, 28 February 2018

If a Windows Server 2016 guest VM on Hyper-V hangs while stopping after Windows Updates, and it won't reboot, it might be caused by the recovery debug information type set. Especially when you have moved the Windows PageFile to a different partition/VHDX.


Microsoft Support article KB307973 states:

You can configure the actions that Windows takes when a system error (also referred to as a bug check, system crash, fatal system error, or stop error) occurs. You can configure the following actions:
Write an event to the System log.
... To take advantage of the dump file feature, your paging file must be on the boot volume. If you have moved the paging file to another volume, you must move it back to the boot volume before you use this feature.

Meaning, you must have a page file on the boot volume for automatic memory dump to work (this is on by default). So turn this option off if you don't have a page file on your boot volume (set it to none). This fixed my reboot issues.

Get Hyper-V guest serial number with PowerShell

List all MAC addresses of all Hyper-V Virtual Machines

Reset the type of debugging information written to the log file.

The (none) option does not record any information in a memory dump file. To specify that you do not want Windows to record information in a memory dump file by modifying the registry, set the CrashDumpEnabled DWORD value to 0.

For example, type the following information at a command prompt, and then press ENTER:

wmic recoveros set DebugInfoType = 0

This is only an issue if the PageFile is on a different VHDX. If you are not sure what the current DebugInfoType is set to, use "get" to look up its value:

wmic recoveros get DebugInfoType

Other values to set the type of memory dump to are:

Value DebugInfoType
0 Disable the creation of a memory dump.
1 Full memory dump. Records all of the contents of system memory when your computer stops unexpectedly. A full memory dump may contain data from processes that were running when the memory dump was collected.
2 Kernel memory dump (default). Records only the kernel memory. This speeds up the process of recording information in a log file when your computer stops unexpectedly.
3 Small memory dump. Records the smallest set of useful information that may help identify why your computer stopped unexpectedly.

If necessary, kill TrustedInstaller.exe if the server is hung during reboot working on updates, using Sysinternals Suite:

c:\path\to\pskill.exe \\servername TrustedInstaller.exe