none
Export then Import to a different Hyper-V server

    General discussion

  • In http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/85dc7d36-491f-4b02-88ac-63c1ed0d94db I described a problem when exporting from a Hyper-V server and trying to import into a different Hyper-V server in a different domain. The import failed and the event log contained:

    Failed to import the virtual machine from import directory 'D:\HV\Test\Test4GB-3\'. Error: One or more arguments are invalid(0x80070057)

    Well I've now identified the source of the problem. In the .exp file is:

    <INSTANCE
      CLASSNAME="Msvm_VirtualSystemGlobalSettingData">
    ...
      <PROPERTY NAME="ScopeOfResidence" TYPE="string">
        <VALUE>
          e7668fbc-216e-4ed1-8ce3-3b932b42e22b
        </VALUE>
      </PROPERTY>

    If I edit the .exp file and delete the <value>..</value> then the virtual machine imports with no errors.

    Looks like a Hyper-V bug to me!

    JR
    Wednesday, October 01, 2008 5:00 PM

All replies

  • Wow I looked everywhere for this post,

    Thanks a bunch John.
    Monday, January 19, 2009 6:01 PM
  • I've just tried this:
    >>delete the <value>..</value>
    And it works a treat.

    I had three Hyper-V VMs to move and all of them failed to import. Making just this single change in each of the .exp files allowed the VMs to import.

    So this is a bug, does anyone know if there is patch? (sooner that R2 or SP2)

    :J


    :J
    Tuesday, January 20, 2009 8:41 AM
  • I just had the same thing happen to me over the weekend when Exporting/Importing Hyper-V VMs to a different 2008 server running Hyper-V.  I'm glad I found this post as well!!
    Tuesday, January 20, 2009 2:06 PM
  • Interesting.  We do know of the issue that import fails if the virtual machine is in a scope that does not exist on the target computer, and that is getting fixed in R2 (currently in the beta build).  What I do not know is how you ended up with a virtual machine in that scope.

    Have you used SCVMM on this system?
    Cheers,
    Benjamin Armstrong
    ============================
    Windows Virtualization
    Senior Lead Program Manager

    This posting is provided AS IS with no warranties, and confers no rights. You assume all risk for your use.
    Wednesday, January 21, 2009 12:54 AM
    Owner
  • >> What I do not know is how you ended up with a virtual machine in that scope.
    >> Have you used SCVMM on this system?

    Yes Ben these are unclustered Hyper-V sysetm's managed by SCVMM so the ScopeOfResidence IS being set by SCVMM.

    Given, sadly, that not everybody will rush to R2 how about a simple fix for 2008 RTM?

    (You may wonder why one would use import and export when you have SCVMM to hand and that is another story for another forum, but basically the Hyper-V box has problems, it actually appears to run just fine and is managed by SCVMM which will report its status but SCVMM will not do complex things like create VMs or migrate VMs from this box as complex operations result in WINRM errors. So the only way to move the VMs off the box is export and import).
    :J
    Wednesday, January 21, 2009 6:40 AM
  • 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 
     

    Cheers,
    Benjamin Armstrong
    ============================
    Windows Virtualization
    Senior Lead Program Manager

    This posting is provided AS IS with no warranties, and confers no rights. You assume all risk for your use.
    Friday, January 23, 2009 11:51 PM
    Owner
  •  I was quite excited to find this post, but I ran not with the same luck :(
    I removed that element <Value>...</Value>   and I keep getting the same error.

    No import success for me.

    Is there a way to look into more error details?


    Thanks.

    Fundacion del Camino
    Sunday, February 15, 2009 9:22 PM
  • Thanks John,

    This worked exactly as described.  You made it easy.

    Ben - Yes the domain this vm export came from had a SCVMM in trial but the Hyper-V Manager was used for the export and subequently for when the import when taken back to my lab office.

    Overall things are OK with Hyper-V (running on Core in the lab) but I'm looking forward to seeing these first version bugs go away.  I know that the R2 beta is out but I've yet to find inplace upgrade instructions for Core - hopefully I'll find those elsewhere and soon.  Thanks for the support and inforamation you posted here.
    Tuesday, March 10, 2009 5:00 AM
  • Thanks, the panic mode is over... I have upgraded one server to System Center and joined to a new domain, when exported the images (not using Library Server yet), and attempted to import, got this ugly error.
    You've saved my date, I mean my night of sleep with this solution!
    Thanks a lot!
    Monday, May 11, 2009 11:26 PM
  • Unfortunately SCVMM uses a SQL server that is virtualized, our domain controllers are also virtualized, so we do need to be able to move them "manually" and this is a pain. There are other occasions where the SCVMM will not move the machine and the export/import works fine (except for manually editing the .exp file each time).
    Saturday, June 20, 2009 5:45 PM
  • Sorry JR, this may be a belated comment, but I dont understand exactly what I am supposed to delete. Can you show me what I delete from this pasted paragraph taken from my  .exp file.

     

    TYPE="string"><VALUE>Global settings for the virtual machine</VALUE></PROPERTY><PROPERTY NAME="ElementName" TYPE="string"><VALUE>Terminal1</VALUE></PROPERTY><PROPERTY NAME="ExternalDataRoot" TYPE="string"><VALUE></VALUE></PROPERTY><PROPERTY NAME="InstanceID" TYPE="string"><VALUE>Microsoft:78BF6281-2CFF-446A-88CC-D41248AAA4BC\Global</VALUE></PROPERTY><PROPERTY NAME="OtherVirtualSystemType" PROPAGATED="true" TYPE="string"></PROPERTY><PROPERTY NAME="ScopeOfResidence" TYPE="string"><value></value></PROPERTY><PROPERTY NAME="SettingType" TYPE="uint16"><VALUE>32768</VALUE></PROPERTY><PROPERTY NAME="SnapshotDataRoot" TYPE="string"><VALUE></VALUE></PROPERTY><PROPERTY NAME="SystemName" TYPE="string"><VALUE>78BF6281-2CFF-446A-88CC-D41248AAA4BC</VALUE></PROPERTY><PROPERTY NAME="Version" TYPE="string"><VALUE>NOT.RTM</VALUE></PROPERTY><PROPERTY NAME="VirtualSystemType" TYPE="uint16"><VALUE>301</VALUE></PROPERTY><PROPERTY NAME="ExportVersion" TYPE="uint64"><VALUE>512</VALUE></PROPERTY></INSTANCE>

     

     

    Sunday, August 28, 2011 1:52 PM
  • Hi John,

     

    Could you elabrate on this.I am unable to pin point this out in my .exp file

     

    Many thanks,

     

    Nojan Emad

    Sunday, September 18, 2011 1:01 PM
  • Hi Eduardo7095, I also tried this steps but still wasn't able to import. How did u resolve urs

    Tuesday, August 28, 2012 1:57 PM
  • FriendsI havethe same problem.
    BelowI'm sendingthem theerror screen.

    Marcus

    Monday, May 26, 2014 5:39 PM