Get location of Hyper-V Virtual Machines with Powershell

Sometime you probably like to re-install your system or replace a disk where you have installed Hyper-V.

In that situation you better keep track of your VMs files.

Here's a one-liner to list the location of the VM files:

 

get-vm * |sort-object| ft -auto Name,path,configurationlocation,snapshotfilelocation,@{L="Disks";E={$_.harddrives.path}}