Hyper-V / WMI Programming Question

I looked at several objects in the root \ virtualization namespace, but I could not find where Hyper-V stores the path to the configuration file for this virtual machine. I need to get this file path programmatically, or at least only the home path to this virtual machine will be fine too. What object and WMI field stores the path to this virtual machine (tell me this is not Msvm_ComputerSystem)?

+3
source share
2 answers

Get the DefaultExternalDataRoot Msvm_VirtualSystemManagementServiceSettingData property to get vm root, and add the Name Msvm_ComputerSystem (guid) and ".xml" property. Even if the virtual machine is created in a non-standard location, you will see a symbolic link in the root directory of the external data by default, referencing the configuration file.

+2
source

This is not entirely true. As WSS2008R2if changing the default virtual data VM in the root of the system data, nothing is written. To find the data root for one virtual machine, you need to find Msvm_VirtualSystemGlobalSettingData, find the property SystemNamethat matches yours VM GUIDand look in the properties ExternalDataRootand SnapshotDataRootto see the folders associated with the VM.

0

Source: https://habr.com/ru/post/1703836/


All Articles