Share via


How to transfer files from virtual machine to host machine

Question

Wednesday, June 25, 2014 4:22 AM

Hello, 

I want to know how to copy files from virtual machine o host machine while the virtual machine running. I can't share files from virtual machine because i am just studying for mcsa in company computer. I can't connect my virtual machine to same network so i'm using a different ip range and i created a internal network switch for my virtual machines in hyper-v. Please give me a best solution for my studies.

Regards,

Ashane Deshapriya.

Ashane Deshapriya ( MCP )

All replies (7)

Wednesday, June 25, 2014 5:29 AM ✅Answered | 1 vote

You can use Remote Desktop.

if you create internal network , there is a network connection between VM and host , so you can use RDP for this purpose.

Whenever you see a helpful reply, click on Vote As Helpful & click on Mark As Answer if a post answers your question.

LinkedIn:   Facebook:   


Wednesday, June 25, 2014 6:08 AM ✅Answered | 2 votes

Hi,

if you are using a Generation2 Virtual Machine you can also Enhanced Session Mode, this even works without a Network Connection between VM and Host:

http://technet.microsoft.com/de-de/library/dn282274.aspx

Regards,

Benedict


Wednesday, June 25, 2014 6:52 AM ✅Answered

Hi Ashane,

have a look at this posts then, they should help you:

http://www.andrewconnell.com/allowing-a-host-machine-to-talk-to-guest-vms-in-hyper-v

http://www.windowsnetworking.com/kbase/WindowsTips/WindowsServer2008/AdminTips/VirtualPlatforms/HowtosharefilesbetweenaHyper-Vhostanditsvirtualmachines.html

http://vniklas.djungeln.se/2013/08/07/exploring-the-hyper-v-2012-r2-and-copy-vmfile-powershell-cmdlet/

Regards,

Benedict


Wednesday, June 25, 2014 6:42 AM

Thanks for the answers. I understand what you all say. But i'm using Generation 1 Virtual Machines. I can't connect this virtual machines to my host network because the company have a AD. Just doing for my testing purpose. That's why i'm asking for a solution.

Regards.

Ashane Deshapriya ( MCP )


Wednesday, June 25, 2014 7:57 AM

Finally I got the solution...

Here is how you can share files between a Hyper-V host and any virtual machines running on that host.

If you've used Microsoft Virtual PC or Microsoft Virtual Server, you'll have enjoyed the fact that you can copy and paste between a virtual machine and those platforms. This doesn’t work with Hyper-V however—you can't copy/paste between a VM and the Hyper-V host.

The workaround is to do the following:

1. On your Hyper-V host, create a shared folder and assign Change permission to Everyone.

2. On the virtual machine running on the host, open the Network and Sharing Center and enable File and Printer Sharing.

3. On the virtual machine, click Start and type \host_name\share_name where host_name is the name of your Hyper-V host and share_name is the name of the share you created.

4. Press ENTER and an Explorer window will open in the VM showing the contents of the shared folder on the host.

5. You can now copy files from the VM to the host and vice versa as needed.

Regards.

Ashane Deshapriya ( MCP )


Sunday, November 18, 2018 1:14 PM

Believe G2 and Enhanced Session won't help copy a file from within the VM to the Host.

yup


Tuesday, November 5, 2019 1:43 AM

New method with PowerShell Direct works wonderfully and you can copy to and from guest VMs even when without network. 

/en-us/virtualization/hyper-v-on-windows/user-guide/powershell-direct?redirectedfrom=MSDN

$s = New-PSSession -VMName <VMName> -Credential (Get-Credential)

Copy-Item -ToSession $s -Path C:\host_path\data.txt -Destination C:\guest_path\

Copy-Item -FromSession $s -Path C:\guest_path\data.txt -Destination C:\host_path\

Remove-PSSession $s

Find this post helpful? Does this post answer your question? Be sure to mark it appropriately to help others find answers to their searches.