How to share files between a virtual machine and a host in Hyper-V

Last update: 02/09/2025
Author Isaac
  • Use SMB, RDP, Copy-VMFile, VHDX or VMConnect depending on your network, security and speed.
  • Enhanced session mode enables clipboard, discs, audio and USB in VMs Windows.
  • VHDX and ISO solve networkless cases; ISO is read-only, while VHDX allows round-trip.
  • Export/Import is used to move entire VMs; it is not a substitute for a good backup.

Sharing files between Hyper-V and virtual machines

When working with virtualization in Windows, Hyper-V acts as the default hypervisor , allowing you to manage virtual machines both locally and remotely. However, something as commonplace as moving data between the host and VMs isn't straightforward: you can't simply drag and drop files into the console like you would with a regular application. Therefore, it's essential to know effective and secure methods for transferring files.

In this guide, I've compiled and unified all the practical ways to share files between your Hyper-V host and your VMs , from SMB shares, RDP with drive redirection, and the PowerShell Copy-VMFile cmdlet (without networking), to tricks like mounting VHDX, leveraging the enhanced session mode in VMConnect, and even using read-only ISO images . You'll also see additional options (exporting/importing VMs, cloud, or web apps ) and a brief overview of VirtualBox and VMware to show you what changes when switching solutions.

Method 1: SMB share on the Hyper-V host

The most direct way in Windows environments is to expose a folder via SMB on the host running Hyper-V and copy ISOs or other files there. This method works from both physical machines and other VMs, as long as there is network connectivity.

First of all, enable on the host firewall the “File and Printer Sharing” group rule to allow incoming SMB connections. You can do this with the following command (CMD or PowerShell): netsh advfirewall firewall set rule group=\"File and Printer Sharing\" new enable=Yes. Make sure to limit permissions on the share only to users who need it.

If you work with a graphical interface, open the Explorer and use administrative shares to connect to the host, for example: \\10.10.10.31\c$\. It is common to create a dedicated folder for ISOs or VM data (e.g. C:\ISO_1\), but for good practice consider storing VMs and media on separate partitions than the system.

From the line of commands, Can map the SMB folder as a network drive with: net use S: \\10.10.10.31\d$. Assigning a letter makes it easier to automate copies and media deployment scripts.

  1. Create/select the destination folder on the host (e.g., C:\ISO_1\) and share with minimum permissions required.
  2. Connect from your computer or VM to the SMB resource and copy the required ISO or file to the route.
  3. In Hyper-V Manager, point the VM's virtual DVD drive to the copied ISO file.

For safety, once you finish, you can disable it again the “File and Printer Sharing” rules with: netsh advfirewall firewall set rule group=\"File and Printer Sharing\" new enable=No. Reduce the attack surface from the host is always recommended.

How to share a network folder in Windows 11
Related articles:
How to Share a Network Folder in Windows 11: Complete Guide

Method 2: Central repository (file server or NAS)

In environments with multiple Hyper-V hosts, replicating ISOs and files across each server consumes storage and complicates maintenance . A better practice is to create a single central SMB resource (file server or NAS) and grant access to the hosts and VMs.

  Example: How can I share my Spotify account with my friends and family?

If all computers are domain members, permission management is simpler . You just need to mount the shared resource from each host/VM that needs it. On Linux VMs , in addition to SMB, you can use SSH/SCP/SFTP for secure transfers across the network.

Remember that if the VM needs to access that resource, it will require a virtual switch and network connectivity in the appropriate mode (external, internal, etc.). Planning the topology prevents bottlenecks and access problems.

Method 3: RDP with Drive Redirection

When the Hyper-V host has a GUI, you can use RDP to connect and redirect local disks , allowing you to copy files from your computer to the host or VM. This procedure also works for Windows VMs with network connectivity.

  1. On the destination, enable Remote Desktop: Start > Settings > System > Remote Desktop > Enable.
  2. Run the RDP client: mstsc (located in %windir%\system32\mstsc.exe).
  3. Enter IP/computer name and user (format domain\user o computer\user).
  4. Go to “Local Resources” > “More…” and mark the units that you want to map (for example, E:).
  5. Connect and, already in the Explorer of the remote computer, you will see the redirected units to copy the files.

This method is very convenient and avoids configuring SMB on the host, with the advantage that you can select exactly which drives to redirect in each RDP session.

Method 4: PowerShell Copy-VMFile (No Network, Host → VM)

PowerShell 4.0 and later versions include a cmdlet that allows you to copy files from the host to the VM without a network connection , without opening ports or modifying the firewall. It's ideal for injecting specific files into isolated VMs.

You must first enable the “Guest Service Interface” integration service on the VM. From Hyper-V Manager, in the VM settings > “Integration Services,” select “Guest Services.” You can also do this in PowerShell: Enable-VMIntegrationService -VMName VM1 -Name 'Guest Service Interface'. Without this service, the cmdlet will not work.

Check the status with: Get-VMIntegrationService -Name Guest* -VMName VM1,VM2. If the status appears “no contact”, update and install Integration Services on the guest system; if you see “False”, enable it with: Enable-VMIntegrationService -Name Guest* -VMName MiVM -Passthru.

To copy, use the pattern: Copy-VMFile \"NombreVM\" -SourcePath \"F:\\Test.txt\" -DestinationPath \"C:\\Temp\\Test.txt\" -CreateFullPath -FileSource HostIn practice: Copy-VMFile \"VM2\" -SourcePath \"C:\\temp\\file01.txt\" -DestinationPath \"C:\\Temp1\\file01.txt\" -CreateFullPath -FileSource Host. Keep in mind that this cmdlet only copies in host → VM direction.

Method 5: Mount a shared VHDX between host and VM

A very flexible approach is to create a "portable" VHDX virtual disk that you can mount on the host to load files onto, and then temporarily attach to the VM to retrieve them. It's fast, controlled, and doesn't require a network.

You can create it from Computer Management > Storage > Disk Management > “Create VHD”. Choose the path (e.g., C:\Hyper-V\data-temp\), size (for example, 8 GB), format VHDX and disk type (“Dynamic Expansion” is recommended). Using PowerShell, an example: New-VHD -Path C:\\Hyper-V\\data-temp.vhdx -SizeBytes 8GB -Dynamic -BlockSizeBytes 1MB.

To mount it on the host: Mount-VHD -Path C:\\Hyper-V\\data-temp.vhdx. Then initialize the disk (MBR for compatibility) and create volume and format: Initialize-Disk 1 -PartitionStyle MBR & New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter & Format-Volume -DriveLetter H -FileSystem NTFS -Full -Force. Once assembled, copy the necessary files inside.

  How to efficiently monitor your project's progress in Microsoft Project

Unmount from the host with: Dismount-VHD -Path C:\\Hyper-V\\data-temp.vhdx and attach the VHDX to the VM from Hyper-V Manager (SCSI Controller > Hard Disk > Add > “Existing Virtual Hard Disk”). Using PowerShell: Add-VMHardDiskDrive -VMName VM2 -Path C:\\Hyper-V\\data-temp.vhdx. When starting the VM, assigns a letter if it does not do so automatically and copies the files to their destination.

This method also works with Linux guests capable of reading NTFS , which adds versatility when mixing systems.

Method 6: VMConnect and Enhanced Session Mode

VMConnect is the native Hyper-V console. With Enhanced Session Mode , the connection uses RDP "behind the scenes" and enables resource redirection (clipboard, drives, printers, audio, microphone, and even compatible USB devices). It is only available for Windows VMs.

To enable it on the host: Hyper-V Manager > right-click the host > “Hyper-V Configuration” > “Enhanced Session Mode” > select “Use Enhanced Session Mode.” In PowerShell: Set-VMHost -EnableEnhancedSessionMode $True. In the VM, enable Remote Desktop and Guest Integration Services.

When you open VMConnect and connect, you'll see a dialog box to choose the resolution; click " Show options " and go to "Local resources" > "More…". Select the host disks you want to redirect to the session. By default, the clipboard and printers are already available, and audio is played on the host.

For audio and microphone settings, go to "Settings" within the connection box and adjust the playback/input . If the VM is running locally, the remote audio options produce the same effect. Controlling sound and voice from the VM can be useful in demos and training.

In the VMConnect toolbar there is an icon that indicates the session type current (basic or enhanced) and allows you to toggle. On Windows 10 2004/Windows 11, if the VMConnect login box doesn't appear, disable in the VM the option to require Windows Hello on Microsoft accounts (Sign-in options) and sign out or restart the VM. If you don't see the connection dialog, run vmconnect.exe "as administrator".

Method 7: Share with ISO images (read-only)

When you only need to transfer files from the host to the VM and don't mind that it's read-only, create an ISO image with the contents and assign it as a virtual DVD drive in the VM. It's unidirectional , and the VM cannot modify those files.

If the ISO needs to be bootable (e.g., for nested virtualization testing), create an empty ISO and add another bootable ISO inside to transfer it to the VM. Then insert it from the virtual machine's DVD drive and work with it as if it were physical media.

Move VMs and data with Export/Import

Beyond simply sharing individual files, Hyper-V allows you to export and import virtual machines , a quick way to move or clone them, including disks, configuration, and checkpoints. You can export with the VM powered on or off (recommended for low workloads).

During the import process, the VM registers with the host, and the wizard helps resolve incompatibilities (memory, virtual switches, CPU). There are three import types: " Register in context " (uses the current location and retains the same identifier, does not leave the export files for reuse), " Restore " (copies the files to another location while preserving the same identifier, leaving the export intact), and " Copy " (like restore, but generates a new identifier , useful for cloning multiple times on the same host).

  Change the boot order in Windows Boot Manager step by step

This method does not replace the previous methods for quick file transfers , but it is excellent for migrating entire environments between hosts or maintaining "golden image" templates.

Generic alternatives: cloud and web applications

Services like OneDrive , Google Drive, Dropbox, or Mega greatly simplify file sharing: you install the client on the host and/or VM and synchronize folders. Avoid duplicating space by choosing "on-demand files" or equivalent (placeholders) and download only when opening.

If you don't want to install anything on the VM, you can always use your browser and access the web version of the cloud service. It's less automated, but suitable for specific cases. Keep an eye on size and bandwidth limits if you're working with large ISOs.

Another option is platforms like WeTransfer , which allow you to share large files by generating a link. Upload from the host, open the link in the VM, and download. It's simple and fast for occasional file sharing, although it doesn't replace continuous synchronization.

Quick context if you alternate between VirtualBox and VMware

Although this guide focuses on Hyper-V, it's helpful to know what changes if you're using other platforms. In VirtualBox, the simplest solution is to configure "Shared Folders" to expose host directories to the guest, checking "Automount" to make them available when the VM starts and "Read-only" if you want to protect the contents.

VirtualBox also allows the use of USB devices with the VM (by enabling the USB controller and selecting the device) and supports drag/drop or shared clipboard by installing Guest Additions and enabling "Bidirectional". In certain scenarios, USB 3.0 can cause boot problems , so it's advisable to try USB 1.1 if you encounter issues.

In VMware, Workstation Player is free for non-commercial use but has limitations (for example, in shared folders). Workstation Pro adds Shared Folders (Options > Shared Folders) and Guest Isolation features (enabling drag and drop and copy/paste). For USB, connect the flash drive and assign it to the VM using the corresponding icon.

These comparisons help you transfer habits between platforms , but remember that in Hyper-V we highlight VMConnect with improved session, Copy-VMFile without networking, and the use of VHDX as a universal “container”.

As a general recommendation, avoid using these methods as a backup system . While they are very useful for moving files, they are not a substitute for a host-level backup solution for VMs, which is more efficient, faster, and more reliable for granular or full recoveries.

With this wide range of options, it's easy to choose the right method for the situation: SMB or RDP for speed when a network is available, Copy-VMFile and VHDX for isolated VMs, VMConnect with enhanced session functionality when you want deep integration with devices and the clipboard, and ISO if you're looking for read-only access. And if you need to move entire environments, exporting/importing provides a streamlined process with compatibility checks.