Scenario: You have deleted a very large number of files from a VHD. i.e 250GB. Once you have deleted the files you notice that the VHD is still 350GB in size (you were expecting it to now be 100GB)
Fix: You now need to compact the VHD using Hyper-V manager to claim back this space. Note this only works for dynamically expanding disks and not fixed size disks however you can convert both ways in Hyper-V Manager.
Steps: note there will be downtime for the VM
1) Log onto the server whose VHD you wish to compact. You will need to run disk defragmenter on this disk first. (May take some time)
2) Once complete, shut down the VM.
3) In Hyper-V manager, open the settings of the VM. Under the properties of the VHD, click Edit. Select Compact
Before completing this step, ensure that there is enough free space to create the compact VHD (in this example 100GB) as the process creates the compact VHD first, then if successful, deletes the original VHD at the last step, so initially there needs to be enough space to store both. (You can determine the free space in Failover Cluster Manager and expanding Cluster Stored Volumes if you use them)