222dea57-bedd-465c-8fe4-54f2ad7ae699 ** => DELETE THIS GUID** 保存更改,然后退出记事本。再次导入修改后的虚拟机。如果要自动解决此问题,可以在将虚拟机导入 Hyper-V 服务器之前在 Hyper-V 服务器上运行 Visual Basic 脚本:Option Explicit Dim WMIService Dim VMList Dim VM Dim VMSystemGlobalSettingData Dim VMManagementService Dim Result 'Get instance of 'virtualization' WMI service on the local computer Set WMIService = GetObject("winmgmts:\\.\root\virtualization") 'Get a VMManagementService object Set VMManagementService = WMIService.ExecQuery("SELECT * FROM Msvm_VirtualSystemManagementService").ItemIndex(0) 'Get all the MSVM_ComputerSystem object Set VMList = WMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem") For Each VM In VMList if VM.Caption = "Virtual Machine" then Set VMSystemGlobalSettingData = (VM.Associators_("MSVM_ElementSettingData", "Msvm_VirtualSystemGlobalSettingData")).ItemIndex(0) VMSystemGlobalSettingData.ScopeOfResidence = "" Result = VMManagementService.ModifyVirtualSystem(VM.Path_.Path, VMSystemGlobalSettingData.GetText_(1)) end if Next 这样就可以完美解决导入虚拟机0x80070057错误问题"> 222dea57-bedd-465c-8fe4-54f2ad7ae699 ** => DELETE THIS GUID** 保存更改,然后退出记事本。再次导入修改后的虚拟机。如果要自动解决此问题,可以在将虚拟机导入 Hyper-V 服务器之前在 Hyper-V 服务器上运行 Visual Basic 脚本:Option Explicit Dim WMIService Dim VMList Dim VM Dim VMSystemGlobalSettingData Dim VMManagementService Dim Result 'Get instance of 'virtualization' WMI service on the local computer Set WMIService = GetObject("winmgmts:\\.\root\virtualization") 'Get a VMManagementService object Set VMManagementService = WMIService.ExecQuery("SELECT * FROM Msvm_VirtualSystemManagementService").ItemIndex(0) 'Get all the MSVM_ComputerSystem object Set VMList = WMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem") For Each VM In VMList if VM.Caption = "Virtual Machine" then Set VMSystemGlobalSettingData = (VM.Associators_("MSVM_ElementSettingData", "Msvm_VirtualSystemGlobalSettingData")).ItemIndex(0) VMSystemGlobalSettingData.ScopeOfResidence = "" Result = VMManagementService.ModifyVirtualSystem(VM.Path_.Path, VMSystemGlobalSettingData.GetText_(1)) end if Next 这样就可以完美解决导入虚拟机0x80070057错误问题">
< 返回文章列表

【Hyper-V虚拟化技术】无法通过Hyper-V管理器导入虚拟机,提示0x80070057错误

发布人:我爱测 发布时间:2023-04-14

20230414-62420.png

尝试导入已使用 Hyper-V 管理器导出的虚拟机时,无法通过在其他服务器上的Hyper-V管理器导入虚拟机。

而且还会收到如下所示的错误消息:

尝试导入虚拟机时出现服务器错误。 未能从导入目录<>路径导入虚拟机。 错误:一个或多个参数无效 (0x80070057) 。

解决方法

若要解决此问题,请按照下列步骤操作:

  1. 找到导出的虚拟机文件夹,然后打开 .exp 文件。
  2. 在 VALUE> 和 </VALUE> 之间的<行中,删除 GUID。 下面是一个示例,其中显示了 .exp 文件中的代码示例以及应删除的值:
<PROPERTY NAME="ScopeOfResidence" TYPE="string">
    <VALUE>
      222dea57-bedd-465c-8fe4-54f2ad7ae699         ** => DELETE THIS GUID**
    </VALUE>
  </PROPERTY>
  1. 保存更改,然后退出记事本。
  2. 再次导入修改后的虚拟机。

如果要自动解决此问题,可以在将虚拟机导入 Hyper-V 服务器之前在 Hyper-V 服务器上运行 Visual Basic 脚本:

Option Explicit

Dim WMIService
Dim VMList
Dim VM
Dim VMSystemGlobalSettingData
Dim VMManagementService
Dim Result

'Get instance of 'virtualization' WMI service on the local computer
Set WMIService = GetObject("winmgmts:\\.\root\virtualization")
  
'Get a VMManagementService object
Set VMManagementService = WMIService.ExecQuery("SELECT * FROM Msvm_VirtualSystemManagementService").ItemIndex(0)

'Get all the MSVM_ComputerSystem object
Set VMList = WMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem")

For Each VM In VMList
   if VM.Caption = "Virtual Machine" then
       Set VMSystemGlobalSettingData = (VM.Associators_("MSVM_ElementSettingData", "Msvm_VirtualSystemGlobalSettingData")).ItemIndex(0)
       VMSystemGlobalSettingData.ScopeOfResidence = ""  
       Result = VMManagementService.ModifyVirtualSystem(VM.Path_.Path, VMSystemGlobalSettingData.GetText_(1))
    end if
Next  

这样就可以完美解决导入虚拟机0x80070057错误问题