对于每个VM,如何获取VHD文件的路径(在父机器中)? [英] For each VM how to get the path (in the parent machine) for the VHD file?

查看:152
本文介绍了对于每个VM,如何获取VHD文件的路径(在父机器中)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了查询(" SELECT * FROM Msvm_ComputerSystem) 枚举VM。我试图获取VHD文件和VM定义文件的路径。 VM文件通常在"C:\ProgramData \ Microoft \ Windows \Hyper-V \ Virtual Machines"中。 如何使用Hyper V WMI类获取此信息?

谢谢,
csundaresh


推荐答案

HI,
我也尝试过这样做(在C ++和powershell中)。
链接下面会给出有用的信息。
http://dungkhoang.spaces .live.com /?_ c11_BlogPart_BlogPart = blogview& _c = BlogPart& partqs = amonth%3d5%26ayear%3d2008

但是链接中给出的powershell脚本可能无法运行。那里缺少一个双引号。在修复之后,如果您没有获得任何有用的输出,请尝试提供"不正确"的VM名称,然后它会提供所有VM的信息。如果你有一个工作的C ++例子也告诉我。

感谢,
Madhu


  I also tried doing the same (in C++ and powershell).
Below link will give useful information.
http://dungkhoang.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=amonth%3d5%26ayear%3d2008

However the powershell script given in the link might not run. One double quote is missing there. After fixing that if you don't get any useful output try giving 'incorrect' VM name then it gives information of all the VMs. If you have a working C++ exmple inform me too.

thanks,
Madhu


这篇关于对于每个VM,如何获取VHD文件的路径(在父机器中)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆