How to share folders between the host and virtual machines in Hyper-V

Last update: 21/05/2025
Author Isaac
  • Hyper-V offers different methods for sharing folders between the host system and the Virtual machines, adapting to diverse environments and needs.
  • Enhanced session mode and integration tools facilitate file and device transfers, optimizing productivity and resource management.
  • The choice of the best method depends on the guest operating system and the desired network and security features for each case.

hyper-v

Sharing folders between the host computer and a virtual machine in Hyper-V It may seem complicated at first, especially if you come from other solutions such as VirtualBox o VMware, where the shared folders feature is very visible and straightforward. However, Hyper-V provides several powerful and secure ways to transfer files and use local resources., both for machines Windows , the Linux, and is constantly evolving to further facilitate interaction between both environments.

In this article you will find A detailed guide that brings together all the practical and recommended methods for sharing folders, files, and devices between your host system and virtual machines created in Hyper-V.We will cover everything from the simplest options, such as enhanced session mode, to advanced solutions using PowerShell, network shares, or mounting virtual disks. The idea is that, regardless of your experience level, you'll find the formula that best suits your needs.

Why share folders and files between host and VM in Hyper-V?

Virtualization plays a crucial role in development, testing, training, and even enterprise deployment environments.And one of the most frequent needs is precisely be able to transfer information between the physical system and its virtual machines in a fast, safe and hassle-free way.

  • Data exchange: Copy installation ISO files, documents, scripts, installers, logs and other resources you need within the VM or from it to the host.
  • Device Sharing: Access to printers, external drives, memory USB or even the clipboard between both systems.
  • Test and deployment automation: If you work in testing or CI/CD environments, you'll often need to move files between hosts and VMs without exposing them to the network.
  • Problem solving: Copy logs or dumps for analysis, install patches, drivers, updates, etc.

Hyper-V uses several strategies to meet these needs without compromising the security or integrity of virtual environments.Let's take a closer look at the available options.

Method 1: Enhanced Session Mode and VMConnect

Enhanced session mode is, since Windows Server 2012 R2 and Windows 8.1, one of the most convenient and powerful ways to share resources between the host and virtual machines in Hyper-V.This method leverages the Remote Desktop Protocol (RDP) but in a way that is integrated into Hyper-V itself, allowing different devices and files to be accessible within the VM.

With enhanced session mode you can:

  • Redirect local drives from host to guest (such as hard drives, USBs, or specific folders).
  • Using the shared clipboard to copy and paste both text and files.
  • Print from the VM to printers attached to the host.
  • Use USB devices connected to the physical computer from the virtual machine itself.
  • Play audio and use local microphones inside the VM.

What do you need to take advantage of this feature?

  • Hyper-V enabled on the host with enhanced session enabled from Hyper-V settings.
  • Guest OS supported:Windows 10, Windows 11, Windows Server 2016 or later. (On Linux systems, capabilities are more limited.)
  • VMConnect (the Hyper-V Virtual Machine Connection Tool) from Windows 8.1 or later.
  • Remote Desktop Services enabled on the VM.
  • Integration services installed and active in the virtual machine (this enables resource sharing and other advanced features).

To activate enhanced session mode:

  1. Open the Hyper V Manager.
  2. Right click on the host name and select Hyper-V Configuration.
  3. In the left panel, select Enhanced Session Mode and check the options to enable it both globally and per user.
  4. Power on the VM and connect using VMConnectIf supported, an additional window will appear to choose the resolution and local resources to redirect.
  Amazon Prime Video Tricks and Hidden Features

How to share specific folders or drives?

  1. In the VMConnect connection window, click on Show options.
  2. Go to the tab local resources, click on Plus….
  3. Select the drives you want to make available in the VM. You can select the entire drive (C:, D:, etc.), specific folders, or even USB devices.
  4. Click on Accept and then connect. The selected drives or folders will appear in the VM's File Explorer under "Redirected Drives and Folders."

main advantages:

  • Easy, fast and safe: : No need to configure networks or SMB sharing permissions.
  • Ideal for fast on-demand transfers.
  • Allows the use of other local devices in addition to units.
  • Supports direct copy and paste of files (as you would do between two Windows desktops with RDP).

Limitations:

  • It only works for OS modern Windows guestsLinux support is limited in terms of graphical experience, although shared resources can be accessed under certain conditions.
  • It is not always enabled by default: You need to make sure that the requirements are met on both the host and the VM.
  • Requires the VM to have remote desktop enabled.

Method 2: Share folders and files over a network (SMB)

A classic way to share files between the host and virtual machines is by using Windows network shares, known as SMB (Server Message Block)This method works for both Windows and Linux VMs as long as they have network connectivity to the host. If you'd like to expand your knowledge on advanced configurations, you can check out our complete guide on secpol-msc what it is.

General steps:

  1. Create a folder on the host and share it with the necessary permits.
  2. In the host's Windows firewall, enable the “File and Printer Sharing” rule (you can do this with netsh advfirewall firewall set rule group=»File and Printer Sharing» new enable=Yes).
  3. Configure the VM to have a network connected to the same segment (This can be a Hyper-V virtual switch, either external or internal, depending on the security and isolation you desire.)
  4. From the virtual machine, access the shared folder using the network path. For example: \\HOST_IP\SHARED_FOLDERYou can also check out how to increase security by configuring options in the control panel at Restrict access to shared folders in Windows.
  5. Enter your login credentials if the folder is protected.
  6. Once finished, you can disable the firewall rule for security. (netsh advfirewall firewall set rule group=»File and Printer Sharing» new enable=No).

Advantages:

  • Works for any operating system that supports SMB/CIFS, including Windows, Linux and others.
  • Allows you to share very specific folders and limit access based on users and permissions..
  • Ideal if your virtual machines are integrated into a domain or require sharing resources between multiple VMs and physical computers.

Security considerations:

  • Set up users with passwords to limit and control access from the VM.
  • Use dedicated shares, not system folders (avoid C$ or D$ unless strictly necessary).
  • Disable sharing when not in use. to prevent possible unwanted access.
  • Consider firewall rules and the risks of leaving SMB open in uncontrolled networks.

Method 3: Transferring files with PowerShell and integration services

Since Windows Server 2012 R2 and recent versions of Hyper-V, there is a very efficient method to transfer files directly from the host to the virtual machine without the need for a network thanks to the PowerShell Copy-VMFile cmdlet. To use it:

  1. Enable Guest Integration Services on the virtual machine. This is done from the VM settings in Hyper-V Manager, by selecting the Guest Services option. You can also activate it via PowerShell with Enable-VMIntegrationService -VMName VM_NAME -Name 'Guest Service Interface'.
  2. Make sure Integration Services are up to date and active in the guest VM.
  3. Use the following command to copy files (from the host) to the VM:
  How to access BIOS or UEFI on your Windows 11 computer

Copy-VMFile «VM_NAME» -SourcePath «ORIGIN_PATH_IN_HOST» -DestinationPath «DESTINATION_PATH_IN_VM» -CreateFullPath -FileSource Host

Points to consider:

  • Only allows transfers in one direction: from host to VM.
  • It does not depend on the VM having an active network or shared resources., you only need the integration services.
  • Perfect for scripts and automation, allowing files to be copied to many VMs in bulk.
  • If you need to copy to multiple VMs, you can read a list of machine names and automate the process with loops in PowerShell.

This function results especially useful when you have isolated VMs for security reasons or testing without network access. Note that the virtual machine must be Windows and compatible with integration services.

Method 4: Mounting virtual disks (VHDX/VHD) to share files and folders

Another efficient solution to share files between host and VM without depending on the network is Create a virtual disk (VHD or VHDX), mount it on the host, copy the information, and then “attach” that disk to the virtual machine..

Summary process:

  1. Create a new virtual disk from Disk Management or with PowerShell (New-VHD -Path «C:\Path\new.vhdx» -SizeBytes 8GB -Dynamic).
  2. Initialize it, create a partition and format the disk (You can do this from the host's Disk Management console or via PowerShell.)
  3. Copy files from the host to the new virtual disk.
  4. Unmount the disk from the host (Dismount-VHD -Path «C:\Path\new.vhdx»).
  5. Attach the VHDX to the virtual machine editing the VM settings and adding the existing hard drive.
  6. Start the VM, mount the drive and transfer/copy the files to the desired location within the VM.

Advantages:

  • Ability to transfer large or multiple files at once.
  • No network or shared resources required.
  • Perfect for closed environments or VMs without external access.
  • Compatible con Windows y Linux (as long as the guest system recognizes the VHDX partition format).

Tips:

  • Choose the disk size based on the volume of files to be shared.
  • Remember to properly unmount the virtual disk before attaching it to the VM.
  • The same disk can be reused for recurring transfers.

Method 5: RDP sessions to copy files between host and VM

On Windows virtual machines, Remote Desktop Protocol (RDP) opens the possibility of connecting from the host or any computer on the network to the VM and, in doing so, redirect local drivesThis allows you to copy files between both systems from Windows File Explorer during the session.

  1. Enable remote desktop on the virtual machine from Settings > System > Remote Desktop.
  2. Use the remote desktop client (mstsc).
  3. Before connecting, click “Show options,” go to “Local resources,” and select the host drives or folders you want to share during the session.
  4. Connect and transfer files as if you were copying over a network.

Advantages: This method is Useful for users who are already familiar with RDP and does not require additional configuration If both machines are on the same network or if remote desktop access is available, the process is secure and controlled.

Method 6: Using ISO images as a read-only disk

If you need to transfer files to the VM but don't mind them being read-only (for example, to install software or copy resources that will later be replaced), you can create an ISO image with the files from the host and mount it as a virtual CD/DVD in the VM.

  1. Create the ISO image using your preferred tools (Windows, PowerShell, or third-party utilities).
  2. Go to the VM settings, select the DVD drive and attach the ISO.
  3. Start the VM and access the ISO content from the explorer.
  How to Manage Users and Groups in Active Directory: A Complete Guide

Limitations: Only allows transfer from host to VM and in read-only mode (changes cannot be modified or saved to the mounted ISO).

Method 7: Other options

In addition to the native Hyper-V options, there are valid alternatives for sharing files and folders:

  • First Class storage on the cloud: You can install OneDrive, Dropbox, Google Drive, etc. on both machines, or upload files from the host and download them from the VM. Convenient for automatic syncing or file access without complex configuration.
  • File transfer web applications: Platforms like WeTransfer and similar platforms allow you to upload files from the host and download them from the VM using a browser. They're quick solutions for one-off exchanges.

Which method should you choose according to your needs?

The choice of the best method will depend on several factors: the guest operating system, the number and size of files, the desired level of security, and whether you want the process to be automated or require two-way access.

Method Requires network Address Guest OS Ideal for…
Enhanced Session Mode DO NOT Bidirectional Windows Ease and occasional use
Share SMB YES Bidirectional Windows / Linux Large volumes and mixed environments
Copy-VMFile DO NOT Host to VM Windows Automation and isolated environments
VHDX disk DO NOT Bidirectional* Windows / Linux Sporadic mass transfers
RDP YES Bidirectional Windows Remote connections and secure access
ISO DO NOT Host to VM (read-only) Windows / Linux Distribution of software or fixed resources

*The VHDX disk can be used both ways as long as it is mounted and then unmounted on each system before moving it to the other, although not simultaneously.

shared network resources
Related article:
Shared resources in Windows: what they are and how to use them correctly on a network

Additional tips for sharing folders and resources in Hyper-V

  • ALWAYS update integration services of Hyper-V on your VMs. Many of the integration and file transfer features are version dependent.
  • Set up dedicated users and strong passwords for folders shared via SMB.
  • Set up a dedicated folder for sharing, instead of system drives.
  • After transferring important files, disable unnecessary shares and firewall rules. to protect your environment.
  • Consider using professional solutions backup for productive environments, instead of manual methods.

Each method has its advantages and disadvantages, and Hyper-V's flexibility allows you to choose the most convenient option based on your workflow. With practice, transferring files and sharing resources will be simple and secure, adapting to different scenarios and needs.

Evaluate these alternatives based on your goals: for rapid transfers, automation, mass migrations, or secure environments. Hyper-V is a mature and versatile tool: with the methods described here, you can take full advantage of its potential in your projects both at home and in professional environments..

How to change the default folder location in Windows 11-2
Related article:
How to Change the Default Folder Location in Windows 11: Complete and Updated Guide

Leave a comment