If you are using dynamic disk for your virtual machine you will soon find out how annoying it is when it grows in size, but when removing the files the disk does not shrink back down. VirtualBox provides tools for compacting a vhdi file but not for vhd. Hyper-v claims to be able to compact, but this often does not work and is also very slow. The solution is to use the built in all powerful Windows Disk Manager.

Run the following commands in an administrative command prompt:

Diskpart

Then type the following commands:

select vdisk File="I:\path\to\your.vhd"
detach vdisk