Hyper-V/WMI 编程问题
我查看了“root\virtualization”命名空间中的几个对象,但无法找到 Hyper-V 存储给定虚拟机的配置文件路径的位置。 我需要以编程方式获取此文件路径,或者至少只是给定虚拟机的主路径也可以。 哪个 WMI 对象和字段存储给定虚拟机的路径(提示它不是 Msvm_ComputerSystem)?
I've looked at several objects in the "root\virtualization" name space but I have not been able to find where Hyper-V stores the path to the config file for a given virtual machine. I need to get this file path programmatically or at least just the home path of a given virtual machine would be fine as well. What WMI object and field stores the path to a given virtual machine (hint it's not Msvm_ComputerSystem) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
获取 Msvm_VirtualSystemManagementServiceSettingData 的 DefaultExternalDataRoot 属性以获取虚拟机根,并附加 Msvm_ComputerSystem (guid) 的 Name 属性和“.xml”。 即使虚拟机是在非默认位置创建的,您也会在默认外部数据根目录中看到引用配置文件的符号链接。
Get the DefaultExternalDataRoot property of Msvm_VirtualSystemManagementServiceSettingData to get the vm root, and append the Name property of Msvm_ComputerSystem (guid) and ".xml". Even if the VM is created in a non-default location, you'll see a symlink in the default external data root directory referencing the config file.
这并不完全正确。 在
WSS2008R2
中,更改默认VM数据根时,系统数据根中不会写入任何内容。 要查找单个虚拟机的数据根,您需要在Msvm_VirtualSystemGlobalSettingData
中查找,搜索与您的VM GUID
匹配的SystemName
属性,然后在 < code>ExternalDataRoot 和SnapshotDataRoot
属性以查看 VM 相关文件夹。This is not completely true. In
WSS2008R2
, when changing default VM data root, nothing is written in the system data root. To find the data root of a single VM, you need to look inMsvm_VirtualSystemGlobalSettingData
, search forSystemName
property matching yourVM GUID
and look inExternalDataRoot
andSnapshotDataRoot
properties to see the VM related folders.