How to Copy Files from Host to Guest VM in Hyper-V

Seamlessly transferring files between a Hyper-V host and its guest virtual machines (VMs) can save significant time and boost productivity. In this comprehensive guide, we will explore various methods to copy files from a Hyper-V host to a guest VM.

Crystal

By Crystal / Updated on January 23, 2025

Share this: instagram reddit

Why Copy Files Between Host and Guest in Hyper-V?

File transfer between a Hyper-V host and guest VM is essential for a variety of reasons:

  • Deploying applications or updates: Moving installer files or patches directly to the VM.
  • Testing configurations: Importing configuration scripts, logs, or tools for testing purposes.
  • Data analysis: Transferring data sets to a secure testing environment.
  • Backup and recovery: Migrating backup files to ensure data protection.

Next, let’s transfer files between Hyper-V host and guest.

How to Copy Files from Host to Hyper-V VM [4 Methods]

Usually, the simplest way to copy files to the Hyper-V server and then from the server to the virtual machine is by drag-and-drop, but this method often encounters problems, leading to operation failures. Next, we will introduce effective methods for copying files from a Hyper-V host to a Hyper-V virtual machine and vice versa.

  • Using Enhanced Session Mode
  • Creating Shared Folders
  • Using PowerShell
  • Using Remote Desktop Protocol (RDP)

Method 1. Using Enhanced Session Mode for File Transfers

Enhanced Session Mode (ESM) is a powerful feature in Hyper-V, allowing users to interact with the VM in a way similar to Remote Desktop Protocol (RDP).

On the Host System:

1. Open the Hyper-V Manager.

2. Click on the host name in the left pane.

3. Navigate to Hyper-V Settings > Enhanced Session Mode Policy.

enable enhanced session mode

4. Check the box to allow Enhanced Session Mode.

On the Guest System:

1. Start the virtual machine.

2. Use the enhanced session mode connection to access the VM.

3. Copy files using drag-and-drop or shared folders.

Method 2. Creating Shared Folders for File Transfer

Shared folders are a straightforward way to move files between the host and guest VM.

To set up shared folders:

1. First, create a folder on your host system and assign it appropriate permissions.

2. Map the shared folder as a network drive on the guest virtual machine.

  • Open File Explorer and click Map Network Drive.
  • Enter the shared folder’s path in the format: \\[host-name]\[shared-folder].

3. Open the mapped network drive in the guest VM to transfer files.

shared folder

Method 3. Transferring Files from Host to Guest Using PowerShell

PowerShell offers a programmatic way to move files between the host and guest VM using the Copy-VMFile cmdlet.

* Note: This method requires the VM to have Integration Services enabled.

Copy-VMFile -Name "TestVM" -SourcePath "C:\HostFiles\Test.txt" -DestinationPath "C:\GuestFiles\Test.txt" -FileSource Host

✍For frequent file transfers, automating the process using scripts can save time and reduce errors. PowerShell and Python scripts are popular for automating file transfers.

$VMName = "TestVM"
$SourcePath = "C:\HostFiles\"
$DestinationPath = "C:\GuestFiles\"
Copy-VMFile -Name $VMName -SourcePath $SourcePath -DestinationPath $DestinationPath -FileSource Host

Method 4. Using Remote Desktop Protocol (RDP)

For guest VMs with RDP enabled, you can connect to the VM using Remote Desktop and enable clipboard and drive sharing for file transfers.

1. Access the VM settings and enable Remote Desktop on the guest virtual machine.

2. Use the Remote Desktop Connection client to connect to the guest VM. Enable local resources such as drives and clipboard.

3. Copy files from the host and paste them into the guest VM.

remote desktop protocol

Automate Backup Hyper-V VM with AOMEI Cyber Backup

AOMEI Cyber Backup is not just a simple backup tool; it is an enterprise-level solution specifically tailored to meet the needs of Hyper-V administrators.

Agentless backup: Eliminating the need for extensive setup and reduces system overhead.
Automation and Regular Backups: Protecting your Hyper-V virtual machines without human intervention.
Incremental and differential backups: Significantly reducing storage consumption and speed up backup tasks.
Centralized Backup Management: Manage multiple Hyper-V hosts and virtual machines from a single interface, simplifying operations and improving efficiency.
Multi-destination Backup: Support local storage, network attached storage (NAS), external hard drive and cloud platforms (e.g. AWS).

This flexibility ensures that your backup data remains safe and readily available even in the event of hardware failure. Download and install AOMEI Cyber Backup from the button below:

Download FreewareVMware ESXi & Hyper-V
Secure Download

Steps to Ensure Successful Hyper-V Backups with AOMEI Cyber Backup

Step 1. Connect Hyper-V host to AOMEI Cyber Backup first.

add hyper-v host

Step 2. Create Hyper-V backup task. Click Backup Task >> Create New Task.

  • Enter a name for Hyper-V VM backup.
  • Select Hyper-V Backup

hyper-v backup

  • Specify a backup storage, such as backup to external hard drive.
  • Enable Archive to store data to Amazon S3 to prevent a disaster affecting the entire site.
  • Set up a backup schedule to minimize the impact on performance.
  • [Optional] Configure backup cleanup plan to delete old backups automatically.
  • [Optional] Enable email notifications to promptly identify and resolve any backup issue.

Step 3. Click Start Backup.

start hyper-v backup

✍To quickly recover data and bring virtual machines online, enable instant recovery in AOMEI Cyber Backup to restore your VMs with ease.

FAQs for Hyper-V Copying Files between Host and Guest

Q: Can I use USB passthrough for file transfer in Hyper-V?

Yes, but USB passthrough is limited in Hyper-V. Enhanced Session Mode or shared folders are better options.

Q: Is there a way to transfer files between Linux guest VMs and the host?

Yes, use SCP, SFTP, or tools like FileZilla to transfer files between Linux VMs and the host.

Q: Do I need a network connection to transfer files between host and guest?

Not necessarily. Methods like Enhanced Session Mode or Copy-VMFile cmdlet work without a network connection.

Q: Can I automate file transfers between the host and guest?

You can automatically copy Hyper-V files from host and guest by using PowerShell scripts or other tools.

Q: What is the fastest way to transfer files in Hyper-V?

For smaller files, Enhanced Session Mode is quick. For larger files, consider shared folders or compressed transfers.

Conclusion

Efficient file transfer methods in Hyper-V, such as Enhanced Session Mode, shared folders, and PowerShell cmdlets, ensure smooth interaction between host and guest environments. By implementing the strategies and tools covered in this guide, users can optimize their workflows and achieve seamless operations in Hyper-V environments.

Crystal
Crystal · Editor
Crystal is an editor from AOMEI Technology. She mainly writes articles about virtual machine. She is a positive young lady likes to share articles with peolpe. Off work she loves travelling and cooking which is wonderful for life.