Shrink Win 10 VHD hard drive

We have several Windows 10 Hyper-V virtual machines running on a Server 2016 server. These virtual machines have all been created with a 127 GB hard drive.

We have downloaded quite a bit of data onto these virtual machines which have almost completely filled up these virtual hard drives.

Now this data has been moved to other locations or deleted and these Windows 10 virtual machines now have over 100 GB of free space. However, the sizes of these Generation 2 Windows 10 virtual machine hard drives are still quite large.

Is there any way of compacting these Generation 2 Windows 10 virtual machine hard drives so that their size will only reflect the amount of space that is actually currently being used and so that these virtual hard drive sizes won't expand again until there is more data put on these Windows 10 virtual machines? How can this be done?
KnowledgeableNetwork EngineerAsked:
Who is Participating?
Alex AppletonConnect With a Mentor Business Technology AnalystCommented:
Here's a link that explains how to do this:

You'll find that you won't be able to reclaim all the white-space on the VHDx file.  Also run a defrag on the volume before attempting to shrink it.
Steve McCarthy, MCSE, MCSA, MCP x8, Network+, i-Net+, A+, CIWA, CCNA, FDLE FCIC, HIPAA Security OfficerConnect With a Mentor IT Consultant, Network Engineer, Windows Network Administrator, VMware AdministratorCommented:
If you are using thin provisioning, it is already done.  If you use thick provisioning, that needs to be changed.
KnowledgeableNetwork EngineerAuthor Commented:
What are the steps to find out if I am using Thick or Thin provisioning?
All Courses

From novice to tech pro — start learning today.