Q: How can I quickly get a list of every virtual hard disk (VHD) that's being used by a virtual machine (VM) on a Hyper-V host?

A: The Windows PowerShell script below finds all VMs on the current host, then lists all the VHDs associated with the VMs.

$VMs = Get-VM
Foreach ($VM in $VMs)
{
  $HardDrives = $VM.HardDrives
  Foreach ($HardDrive in $HardDrives)
  {
    $HardDrive.path | Get-VHD
  }
}

 

See also "Using PowerShell to List VHDs In a Hyper-V Cluster."