I have a lab environment with System Center using Hyper-V on my Windows 8 laptop. This is how I compact the virtual disks using powershell when they get too big.
- Mount-Vhd –path <full path the vhd file> -readonly
- Optimize-Vhd -path <full path the vhd file> -Mode Full
- Dismount-vhd -path <full path the vhd file>
Sometimes I have to run the optimize-vhd command a few times before it actually optimizes it, this seems to be a bug. You can automate this by scheduling it as a task and never worry about it again.