A virtual machine in Hyper-V consists of a few files that account for its virtual hardware configuration and the virtual storage (VHD and VHDX files).  By default the virtual machine configuration files are stored inC:\ProgramData\Microsoft\Windows\Hyper-V, and the virtual hard drives are stored in C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks.

One slight improvement in Hyper-V (in Windows Server 2012) is that during the installation process (GUI mode only) it gives you the option of changing these defaults.  However the defaults are still the same as they used to be… on the C drive.

Being cheap I only have a ‘tiny’ SSD (ok folks I bought it years ago and it felt like it was a fortune back then…) as C:\, all other data is still on rusty spindles on my home lab.

VMs, I know are important but are small are still on the C:\ however others I had to move off.

Now tiering storage is fine, it is a PITA to find where which VHD/VHDX is stored via GUI. The fastest way I found to scavenger your lost treas… um VHDs is of course Powershell.

then being a little OCD…, I like to sort it after names. An example can look like this:

Now, that is not bad, what if I need more info, let’s say also the VMID so you can quickly RDP into the VM (see my post about RDCMan).

Easy, Get-VMHardDiskDrive does not have the info about the VMID, Get-VM however does, so we can just pipe that in it like so:

That will give us a nice list with the VMname, VMID and VHD(x) path.

Another thing to mention. if you wan to change the default location of your VM Disks, or even of the machines, Powershell can do that as well:

or via GUI of course in the Hyper-V settings:


Post Navigation