Problem Description
You may receive the following error message if you try to import a VM.
Error Message
A server error occured while attempting to import the virtual machine.
Failed to import the virtual machine from import directory‚ D:\Export\VM\‘. Failed to import the virtual machine from import directory‚ D:\Export\VM\‘. Error: One or more arguments are invalid (0×80070057)
Event Log
Log Name: Microsoft-Windows-Hyper-V-VMMS-Admin Source: Microsoft-Windows-Hyper-V-VMMS Date: 10/10/2008 9:40:59 AM Event ID: 18080 Task Category: None Level: Error Keywords: User: SYSTEM Computer: server.domain.com Description: Failed to import the virtual machine from import directory 'path'. Error: One or more arguments are invalid(0x80070057)
An event is not registered in all cases in Microsoft-Windows-Hyper-V-VMMS-Admin Log and the mentioned above error message may indicate two different type failures.
1. A problem with the export folder.
2. If a track ID is set to the VM by SCVMM and not removed during the unistallation of System Center Virtual Machine Manager.
Impact
Import of VM’s is not possible which prevents the migration of VM’s.
Solution
1. A problem with the export folder may cause this problem. I haven’t found out the root cause but creating a new export folder may solve the problem. After creating a new export folder, export the VM’s again into the new export folder and import it again from there.
2. After adding Hyper-V hosts to SCVMM,Virtual Machine Manager creates track ID’s for VM’s named #CLUSTER-INVARIANT#:{GUID}
.The Track ID’s (GUID’s) are visible in VM’s settings under Name in Hyper-V Manager. These track ID’s are also mentioned in Virtual Machines configuration file "*.exp"
as “ScopeOfResidence”
.
This is by design and is done so that SCVMM can track VM’s between Cluster Nodes or if an admin moves a VM from one Hyper-V host to the other.
After uninstalling SCVMM, Virtual Machine Manager does not remove the track ID’s. It’s a BUG based on the information from „Ben Armstrong“.
Ben Armstrong [MSFT] says :
“We are not planning to fix this for Windows 2008 at the moment – as SCVMM work around the problem when they move virtual machines (they remove the scope section just like you have done here). But here is a handy VBScript that you can run on a Hyper-V server that will go through and nuke all the scopes (do not use this if you are still using SCVMM) so you can export and import happily (note that you need to run this before exporting):”
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
How to remove the track ID’s (GUID) :
Open the affected VM’s configuration file "*.exp"
with notepad.exe.
The configuration file has the "*.exp"
extension and is under the Export folder "\VM Name\Virtual Machines\*.exp"
.
<PROPERTY NAME=”ScopeOfResidence” TYPE=”string”> < VALUE> f9667fdc-615e-4el1-8mv7-9u968c45e41f ** –> DELETE THIS ** < /VALUE> < /PROPERTY>
After removing the track ID‘s you will able to import the virtual machine.
Good luck !