Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
Use PowerShell to list every VHD used on a Hyper-V host.
September 2, 2013
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-VMForeach ($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."
You May Also Like