How to Shrink a VHDX
Open an elevated PowerShell prompt on a host that has access to the VHDX file. A remote PowerShell session to a suitable host will also work. If the target volume is on an SMB share, be aware that a remote session to the host will be subjected to the double-hop issue. Try to get directly to the system that holds the target file.
- The VM must be in the Off state before you can proceed. Online resize is supported only for growth operations.
- Use Get-VHD as described above to verify that the MinimumSize is present and is smaller than the Size.
- Use Resize-VHD to finish up. Your best option is to use the -ToMinimumSize parameter, although you have other options, viewable in Get-Help .
Verify the results in the VM’s Disk Management tool or Get-Volume.