【问题标题】:Getting error 32775 while applying latest snapshot on HyperV VM using WMI使用 WMI 在 HyperV VM 上应用最新快照时出现错误 32775
【发布时间】:2014-02-07 00:53:43
【问题描述】:

当我尝试使用 WMI 将我的虚拟机恢复到最新快照时,我不断收到错误 32775(此操作的状态无效)。我正在使用以下代码(顺便在 MSDN 网站上提供):

ManagementObject virtualSystemService = Utility.GetServiceObject(connectionScope,"Msvm_VirtualSystemManagementService");
ManagementBaseObject inParams =virtualSystemService.GetMethodParameters("ApplyVirtualSystemSnapshot");
ManagementObject vmSnapshot = GetLastVirtualSystemSnapshot(vm);
if (vmSnapshot != null)
{
    inParams["SnapshotSettingData"] = vmSnapshot.Path.Path;
    inParams["ComputerSystem"] = vm.Path.Path;
    ManagementBaseObject outParams = virtualSystemService.InvokeMethod("ApplyVirtualSystemSnapshot", inParams, null);
    if ((UInt32)outParams["ReturnValue"] == ReturnCode.Started)
    {
        if (Utility.JobCompleted(outParams, connectionScope))
        {
            Console.WriteLine("Snapshot was applied successfully.");

        }
        else
        {
            Console.WriteLine("Failed to apply snapshot.");
        }
    }
    else if ((UInt32)outParams["ReturnValue"] == ReturnCode.Completed)
    {
        Console.WriteLine("Snapshot was applied successfully.");
    }
    else
    {
        Console.WriteLine("Apply virtual system snapshot failed with error {0}", outParams["ReturnValue"]);
    }
}
else
{
    Console.WriteLine("No Snapshots!");
}

我可以毫无问题地在 UI 上应用快照,并且我的虚拟机处于启用状态并且没有执行任何操作。操作系统是 Windows 2012。我还可以打印快照和虚拟机的名称,这样识别机器和快照就没有问题了。

有什么想法吗? 谢谢, 沙哈布

【问题讨论】:

    标签: c# wmi hyper-v


    【解决方案1】:

    发现问题了,如果您想远程应用快照,显然需要关闭虚拟机!也许在 MSDN 网站上提到这一点太难了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-05
      • 2017-02-24
      • 1970-01-01
      • 2016-04-14
      • 2014-11-04
      • 2019-04-25
      • 2010-11-12
      • 1970-01-01
      相关资源
      最近更新 更多