【问题标题】:Passing "A string representation of an embedded instance"传递“嵌入式实例的字符串表示”
【发布时间】:2015-05-14 10:51:36
【问题描述】:

Msvm_ReplicationService::GetReplicationStatisticsEx方法需要两个参数:

[in]  CIM_ComputerSystem ComputerSystem,
[in]  string ReplicationRelationship, 

ReplicationRelationship 是一个对象,所以我不知道它为什么需要它作为字符串。 文档说:

“ReplicationRelationship [in] Msvm_ReplicationRelationship 类的嵌入式实例的字符串表示形式,它定义了要为其检索复制统计信息的复制关系。”不知道这意味着什么!

当我传入以下内容时,我收到“无效参数”错误:

rel.ToString()

rel["InstanceID"].ToString()

有人知道如何调用这个方法吗?

这是 rel 的来源:

ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\virtualization\\v2", "SELECT * FROM Msvm_ReplicationRelationship"); 

    foreach (ManagementObject rel in searcher.Get()) {
        //string representation of rel required here
        //At the moment, just looping through all relationships for simplicity
    }

【问题讨论】:

    标签: c# .net wmi hyper-v


    【解决方案1】:

    您尝试过getText() 方法吗?我认为这会返回所需的表示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-24
      • 1970-01-01
      • 2017-04-17
      • 1970-01-01
      • 2017-11-19
      • 1970-01-01
      相关资源
      最近更新 更多