Cannot Boot VHD Virtual Disk After Resize Process Froze

I have seen this scenario before where admins will power down a VM to edit the VHD. The issue is that after a few hours the expand progress will just hang at a specific percentage. I have also read that some admins will go into task manager and kill the MMC process to stop it altogether. Stopping the MMC process can end up corrupting the VHD file. Here is a way that I was able to recover a corrupt VHD file in this scenario.

I used the VhdTool.exe from Microsoft. Below are the three items that it can do.

VhdTool.exe /create [/quiet]
VhdTool.exe /convert [/quiet]
VhdTool.exe /extend [/quiet]

Create: Creates a new fixed format VHD of size.
WARNING – this function is admin only and bypasses
file system security. The resulting VHD file will
contain data which currently exists on the physical disk.

Convert: Converts an existing file to a fixed-format VHD.
The existing file length, rounded up, will contain block data
A VHD footer is appended to the current end of file.

Extend: Extends an existing fixed format VHD to a larger size.
WARNING – this function is admin only and bypasses
file system security. The resulting VHD file will
contain data which currently exists on the physical disk.

To fix the VHD file I used the Extend command.

Command Prompt
Vhdtool.exe /extend “c:\data\example.vhd” “161061273600”

The new size needs to be in bytes. 161061273600 = 150 GB

It extended the .vhd and then I was able to mount to the virtual machine.