October 14th, 2013

PowerTip: Identify Locations of Hyper-V Config Files

Doctor Scripto
Scripter

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.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback