Exporting to / Importing from a network share [Hyper-V]

Exporting to / Importing from a network share [Hyper-V]

  • Comments 10


The first thing that I needed to do as part of my big rebuild was to move non-critical virtual machines to a remote file server.  The easiest way to do this would have been to export the virtual machines to a local location and then move them up to a network share.  Unfortunately I did not have enough space on the local hard disk to do this.  So what I needed to do was to export the virtual machines directly to a remote network share.

Luckily I had two things working in my favor:

  1. Both my Hyper-V server and my file server (okay, it was actually my desktop computer) are in the same domain
  2. I was performing the operation directly from the Hyper-V console (not using remote management tools)

Now it is possible to do this still if the above two items are not true – but it gets a lot more complicated.

Given this setup I needed to create and configure a share for the exported virtual machines to be created on.  I logged into my desktop computer and created a share – which granted full access to my user account by default.  But this is not enough for Hyper-V.

Hyper-V does a lot of operations using local service accounts on the Hyper-V computer.  So the network share needs to have permission granted for both the user account that you are using and for the computer account for the Hyper-V server.  The user account is easy to setup (and in my case was setup by default).  Setting up the computer account is a little trickier.

To do this on a Windows 7 computer you will need to go to the folder that is being shared and:

  1. Right click on the folder and select Properties.
  2. Click on the Sharing tab.
  3. Click on the Advanced Sharing… button.
  4. Click on the Permissions button.
  5. Click on the Add… button.

    If your user account does not have access on the share – now is a good opportunity to add it.  The next step is a little bit tricky – because this dialog does not allow you to add computer accounts by default.

  6. Click on the Object Types… button.
  7. Check Computers and click OK.

    image 
  8. Type the name of Hyper-V server followed by a “$” into the text box and click OK

    My Hyper-V server is named “Hyper-V” (original – I know) so for me I have to type in “Hyper-V$”.

  9. Give the Hyper-V server computer account full control on the share (and your user account if you are adding it at the same time) by checking the Allow option next to Full Control when the computer account is selected.
  10. Click OK and click OK again.
  11. Click on the Security tab.
  12. Click Edit…
  13. Click Add…
  14. Click on the Object Types… button.
  15. Check Computers and click OK.
  16. Type the name of Hyper-V server followed by a “$” into the text box and click OK
  17. Give the Hyper-V server computer account full control on the share by checking the Allow option next to Full Control when the computer account is selected.
  18. Click OK
  19. Click Close

Now that all of that is done you can go to the Hyper-V server, select the virtual machine that you want to export, and when you are prompted for a location you can type in the UNC path of the share you have just created, and specify a subfolder for the virtual machine.  For example – if I was exporting a virtual machine called “WDS Server” to the “Export” share on my computer “Benjamins-PC” I would enter “\\Benjamins-PC\Export\WDS Server” into the export location for the virtual machine.

When you want to import the virtual machines back off the network share – you need to ensure that you select to “Duplicate all files so the same virtual machine can be imported again” – as we do not support running virtual machines from a network share.

One final note to make – while we do not support running virtual machines from folders where NTFS compression is enabled – you can enable it on a folder where you are storing exported virtual machines to reduce the amount of space needed.

Cheers,
Ben

Leave a Comment
  • Please add 8 and 2 and type the answer here:
  • Post
  • I want to export the VM to a NAS System which is Unix based, so I cannot use the description given here. I would have to set up an account on the NAS with the same User name and Password to make it work. How can I solve this problem?

  • Hi Ben. It looks like a very useful sulution. Unfortunately, I must export/backup VMs from various hardwares in a DMZ, so no domain is implemented.

    If I try to add VMserverNAME$ as you explained, I am not able to complete the operation, since the object cannot be found :-(  I supose because it is a workgroup environment :-((((

    Do you have a eorkaround ?

    Have a nice day

    Julian

  • Hi Ben. It looks like a very useful solution. Unfortunately, I must export/backup VMs from various hardwares in a DMZ, so no domain is implemented.

    If I try to add VMserverNAME$ as you explained, I am not able to complete the operation, since the object cannot be found :-(  I supose because it is a workgroup environment :-((((

    Do you have a workaround ?

    Have a nice day

  • Hi Ben , Is there a way to use export onto a library server and later import from library server onto the host ?

    Thanks

  • I mistakenly copied the VM's to a USB attached drobo from 2008r2 and delted them from the host. What a mistake, Since I did no export.

    I exported a new one and now see a structure and a couple xml type files. Two files and a file structure are missing from the ones I had earlier moved/copied out. Can I fake it to get them back? Looks like one file is easy but the other looks like a cab file with a familiar xml structure, but lacks info I cannot see that needs edit...

  • Many thanks for taking the time to post this - explains the strange error I am getting while attempting to export to a network share.. Thank you.

  • Hi Ben,

    I did what you mentioned above. Yet it does not work in my environment. Could it be because I'm using the Hyper-V console from the destination host? The source host is server Core therefore it has no console.

  • Hi,

    Do I have to this if I'm exporting the VMs to Cluster Shared Volumes (CSV)?

    I need to export 5 VMs from Hyper-V R2 (W2K8 R2) to Hyper-V 3.0 (W2K12).....

    Thanks in advanced.

  • OK, Scenarios:

    both Hyper-Vs joined to the same domain (or trusted domains):

    the Computername$ trick will work.

    the source joined to the domain and the destination not joined:

    enable Guest account temporarily, give Share and NTFS permission to guest. the export will work.

    the source not joined to the domain, the destination joined:

    have not tested!

    neither the source nor the destination joined to the domain:

    I can NOT get the export working what so ever! will not give up on this though.

    Do you have any idea why this is like this? my VMs are rather big and it takes twice the time to export it to a local storage and then manually copy over the network. I prefer to be able to export over the network even if the 2 hyper-Vs are not joined to any domain.

  • Another solution, on Hyper-V 2012 R2 core, this is what I used...

    1. Connected usb ext drive to host, not joined to domain. Shared drive: net share <share name>=e:\ /GRANT:<hyper-v admin user>,FULL

    2. From domain member VM, SBS 2011(or other vm of your choice), map network drive, check reconnect at logon and connect using different credentials.  \\<host server name>\<share name above> and enter the credentials for the hyper-v admin user above.

    Used to backup files for off-site using 2 external drives to alternate backups. Works for using the same drive mapping on the VM for file backups.

    Paul

Page 1 of 1 (10 items)