Windows Server

Resize Hyper-V .vhdx To Minimum Size

A really neat new feature in 2012R2 is that Hyper-V can resize a running virtual machine (.vhdx) to the smallest possible size, while the virtual machine is running. To do so, use Get-VM in PowerShell. Here, we’ll use the -Path option to define the location of our vhdx, the -ToMinimumSize option to indicate that we’d like to shrink it down as low as we can go and -AsJob so it runs in the background:

Resize-VHD –Path D:\myVM.vhdx –ToMinimumSize -AsJob