PowerTip: Identify Locations of Hyper-V Config Files

Summary: Use PowerShell to find the .xml files of Hyper-V virtual machines.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily find the location of my virtual machines after I reinstalled Hyper-V in Windows Server 2008 R2?

Hey, Scripting Guy! Answer The virtual machine configuration is stored in an .xml file with a GUID, and you can use Get-ChildItem to easily parse a hard drive to find the location.

To scan drive C: for all .xml files:

GET-CHILDITEM C: -recurse -include *.xml

To be more efficient, target only C:ProgramData where the data, including hidden folders, is stored:

GET-CHILDITEM C:ProgramData –recurse –include *.xml –force

If you need to manually rebuild configuration data, you can parse files for machine names and data.