0

Quick Tip–Verify VHDs Mounted In Hyper-V VMs

If you want to easily view all of the VHD or VHDX files that have been configured on Hyper-V VMs, the below PowerShell command makes this easy.

Since I may use a temporary VHDX as a mechanism to copy files into VMs, it sometimes get left mounted and this makes it easy to see which VM has that particular disk file attached.  Creating a temporary VHDX makes it easier to copy large source files to VMs that may not have direct network access.

 

Get-VM | Get-VMHardDiskDrive

 

Using PowerShell to List All Virtual Hard Disks

 

PowerShell may truncate the full path to the VHD or VHDX file.

If you need to see the full path, then you could do something like this:

Get-VM | Get-VMHardDiskDrive | Select-Object VMName, Path | FT -AutoSize

Using PowerShell to List All Virtual Hard Disks

 

Cheers,
Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

Your email address will not be published. Required fields are marked *