我想修改Msvm_VirtualSystemManagementService资源并希望使用Msvm_VirtualSystemManagementService的DestroySystem方法..为此,我希望获得对CIM_ComputerSystem实例的引用,该实例表示要销毁的虚拟机实例。但我不知道如何使用j-interop ..请帮助我......谢谢
答案 0 :(得分:0)
使用http://jwbem.sourceforge.net/您应该能够获得Msvm_ComputerSystem参考
(来自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());
}