Accessing USB devices from virtual environments such as VMware and Hyper-V is useful in many situations. In this article, we are going to show you how to make a USB recognizable in Hyper-V either as a host or client.
Hyper-V USB Passthrough is the ability to access USB devices from within Hyper-V (formerly known as Windows Server Virtualization)
Table of contents:
- Access USB in Hyper-V in 3 clicks
- How to get Hyper-V to recognize USB
- Server side USB passthrough in Hyper-V
- Hyper V Enhance session mode - access USB with RDP client
Access USB in Hyper-V in 3 clicks
USB over Network (aka USB Network Gate) provides a solution to the question of how to access a USB in Hyper-V. The specialized communication software enables you to attach USB devices in Hyper-V by sharing USB devices across a network.
USB Network Gate is a client-server solution, meaning that its server-side gives access to USB devices to other computers on the network or to Virtual Machines, and client-side allows using them as local resources. You can use any computer connected to the network as a server, either Windows 10, Mac or Linux one.
Here’s how to access USB in Hyper-V by employing the dedicated software solution of USB Network Gate.
This solution requires just a few easy steps to implement Hyper-V USB passthrough. No additional hardware or configuration is required.
- Install the software on the host and guest operating systems.
- Share a device that is physically attached to the host over your network.
- On the client VM locate the USB peripheral in the application and click ‘Connect’.
That’s how to mount a USB flash drive in Hyper-V. It really is that easy. You will see the peripheral in your VM’s Device Manager and be able to access it as if it was directly connected to your machine.
Pros and cons to access USB in Hyper-V with USB Network Gate
- Virtually all USB devices are supported.
- Simple configuration to implement USB access across the network.
- USB Network Gate is compatible with the Linux, Mac and Windows operating systems including Windows 10.
- Creates secure USB connections.
- USB Network Gate is commercial software and has a financial cost.
- Network connectivity is needed to redirect USB traffic.
How to get Hyper-V to recognize USB
Hyper-V USB passthrough can be performed at the client Hyper-V level or at the host level if you are connecting to USB devices.
Server-side USB passthrough in Hyper-V
It is not as easy to implement Hyper-V USB passthrough as it is to set it up in VMware. Let’s take a look at how it’s done in the following step-by-step demonstration.
- We will attach a 32GB USB flash drive into a Hyper-V server and designate it as Drive E. The host operating system immediately sees the drive as available system storage.
Note: A potential issue is that direct access to the USB device is limited to one operating system at a time. In order to make the device available to the Hyper-V clients we need to take it offline and remove the logical connection to the host OS.
- We do this by opening the machine’s Run prompt and executing the DISKMGMT.MSC command. This starts the Disk Management console. Locate the entry for your USB disk and right-click on the disk. You need to use the actual disk, not the drive letter or volume name.
There is an Offline option in the shortcut menu which will be used to take the disk offline.
Note: The Disk Management Console might not offer the Offline option for small USB storage devices. If that is the case, passthrough for USB in Hyper-V will not be able to be implemented.
- Open the Hyper-V Manager after you have successfully taken the USB device offline.
- Select the VM that requires access to the device. Right-click on it and select Settings from the shortcut menu which opens the VM settings screen.
- Next, you need to select the Hard Disk option for the SCSI controller and click the Add button.
- When the next screen displays, select the Physical Hard Disk option and use the drop-down menu to select your USB storage device.
Now the Virtual Machine should be able to recognize and access the USB device. You may need to use the VM’s Disk Management Console to add a drive letter if the device is not immediately visible.
Hyper V Enhance session mode - access USB with RDP client
To copy files between virtual machines in earlier versions of Hyper-V you employed a network file copy or Remote Desktop Connection session. Both of these options entail having an operational network connection. Using the Virtual Machine Connection limited the amount of data that could be sent to the VM.
A similar method is used in enhanced session mode but the requirement to connect to the VM over the network is eliminated. All that is needed is a network connection to the Hyper-V host where the VM is running.
This feature of enhanced session mode can be instrumental in cases where a VM needs to interact with local devices but may not be able to achieve network connectivity. Here are some examples:
- Printing to a local printer from a VM
- Using a USB-attached reader to log into a VM using a smart card
- Debugging issues encountered with a VM without requiring it to be network connected
Developers can make use of Microsoft Hyper-V USB passthrough to test and debug USB applications from within a VM without relying on Remote Desktop Connection.
- Hyper-V Manager is used to configure enhanced sessions. Simply select the Hyper-V server to be configured and click on ‘Hyper-V Settings’.
- Enable server settings in the Enhanced Session Mode Policy which will be used for all VMs running under the Hyper-V host. Enabling the allow enhanced session mode setting determines if the guest VMs can make use of enhanced sessions.
- When enabled, enhanced session mode connections are allowed by Hyper-V if certain conditions are met. They are:
- ✔ The OS of the virtual machine supports enhanced session mode.
- ✔ The VM is running Remote Desktop Service.
- ✔ The Virtual Machine Connection tools requested an enhanced session mode connection.
Disabling the allow enhanced session mode setting forces the Virtual Machine Connection tool to use the methods previously seen in pre-R2 Hyper-V releases.
Enabling User Settings
Enhanced session mode is used to configure user settings. Enabling this setting allows the Virtual Machine Connection tool to use enhanced session mode if it is available in the guest VM. The following conditions must be met for enhanced session mode to be used:
- The OS of the guest VM supports enhanced session mode.
- Remote Desktop Service is running on the guest.
- Allow enhanced session mode is enabled on the Hyper-V host.
So, does Hyper-V support USB devices? As we have demonstrated, the answer is yes. You can enable USB support in a few different ways, but we believe that using the USB Network Gate application is the easiest and most effective solution. It will save time when compared to using Hyper-V enhanced session mode and any other solution.