I recently used https://github.com/okibcn/wslcompact to shrink a couple of WSL VHDX files, and it worked great.
Looking at the source, it seems to use a `wsl --export` option rather than `diskpart`.
Looking at the source, it seems to use a `wsl --export` option rather than `diskpart`.