When importing a VM into Windows Server 2012 that was exported from Windows 2012 R2 you will be unable to import the VM. If you import the VM using PowerShell’s Import-VM cmdlet the error message is not very descriptive – “The operation cannot be performed because the object is not in a valid state”. You will also find EventID 15040 in the VMMS event log.
The full error message for reference:
Import-VM '.Virtual MachinesF5164EF0-5F87-40F1-9872-C669406A18A5.XML'
Import-VM : Failed to import a virtual machine.
The operation cannot be performed because the object is not in a valid state.
At line:1 char:1
+ Import-VM '.Virtual MachinesF5164EF0-5F87-40F1-9872-C669406A18A5.XML'
+ CategoryInfo : InvalidOperation: (Microsoft.HyperV.PowerShell.VMTask:VMTask) [Import-VM], Virtualizatio
+ FullyQualifiedErrorId : InvalidObjectState,Microsoft.HyperV.PowerShell.Commands.ImportVMCommand
If you look in the Microsoft-Windows-Hyper-V-VMMS/Admin event log, EventID 15040 should be present, stating that “Failed to import a virtual machine”.
Not much to go on and troubleshoot there…
Let’s retry this using the GUI…..
If you used the Hyper-V Manager to import the same VM it provides a clue:
Now that we have an error code, we can plug that into our favourite search engine. Which should lead you to the following KB article:
KB 2868279 Moving a virtual machine (VM) from a Windows Server 2012 R2 Hyper-V host to a Windows Server 2012 Hyper-V host is not a supported scenario under any circumstances.
I wanted to publish this quick post so folks who gravitate to importing via PowerShell can search and easily find the cause of the issue since it is the GUI that provides the clue.