Finding differences between used space in a VM and VHD size

What we’re finding is that there is a lot of “white space” consumed by VHDX files.

It would be good to run a script to determine the amount of white space, so that we can (provided the VHDX is dynamic) migrate the VHDX to another volume to release the white space.

I script that checks the VM used space, then the VHDX size to flag up white space…

Any help appreciated!

Thanks

Would https://blogs.msdn.microsoft.com/virtual_pc_guy/2014/06/10/looking-for-wasted-space-inside-virtual-machines/ be helpful?

Thank you and I will be using that script for Static drives!

The problem and fix I have is on this site:

I need help putting together a script that can show me all VMs with claimed whitespace.

Thanks