简体   繁体   English

Hyper-V删除VM J-Interop

[英]Hyper-V Delete VM J-Interop

I want to modify Msvm_VirtualSystemManagementService resource and want to use DestroySystem method of the Msvm_VirtualSystemManagementService.. for that purpose i want to get A reference to an instance of the CIM_ComputerSystem that represents the virtual machine instance to be destroyed. 我想要修改Msvm_VirtualSystemManagementService资源,并想使用Msvm_VirtualSystemManagementService的DestroySystem方法。为此,我想获得对CIM_ComputerSystem实例的引用,该实例代表要销毁的虚拟机实例。 But i don't know how to get using j-interop.. Kindly help me..Thanks 但是我不知道如何使用j-interop ..请帮助我..谢谢

Using http://jwbem.sourceforge.net/ you should be able to get a Msvm_ComputerSystem reference 使用http://jwbem.sourceforge.net/,您应该能够获得Msvm_ComputerSystem参考

(sample from jwbem doc) (来自jwbem doc的示例)

import com.hyper9.jwbem.SWbemObjectSet;
import com.hyper9.jwbem.msvm.MsvmComputerSystem;

...

// Define the WQL query that returns all of a Hyper-V's virtual machines.
String wql = "SELECT * FROM Msvm_ComputerSystem WHERE Caption='Virtual Machine'";

// Execute the query.
SWbemObjectSet<MsvmComputerSystem> compSysSet = svc.execQuery(wql, MsvmComputerSystem.class);

// Print the names of the virtual machines.
for (MsvmComputerSystem cs : compSysSet)
{
  System.out.println(cs.getElementName());
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM