A major disadvantage of Hyper-V compared to other hypervisors (such as VMWare ESXi or Proxmox) is the lack of the ability to redirect USB devices from the host to the virtual machines. As of Hyper-V 2012 R2, there have been some changes to the USB gateway options, but this feature is still inferior to the competition. In this article we will discuss the possibilities of USB redirection on Hyper-V.

Overview of the USB Hyper-Vgateway

USB pass refers to the ability to redirect a USB device from the host hypervisor (or over the network from another server/device) to the virtual machine. A USB passport allows you to pass a USB flash drive, token, modem, or other device connected to the USB port on the physical host to the virtual machine.

The bad news is that Hyper-V does not support full USB access. It is not possible to redirect a USB device from a physical host to a virtual machine (VMWare is much better – see the article USB passthrough in VMWare ESXi). There are several built-in options for using an external USB device in a Hyper-V virtual machine, but they all have important limitations. At this time, you can use the following methods to redirect the USB device to the Hyper-V virtual machine.

  • Redirect the USB drives from the Hyper-V host;
  • Improved session mode on the Hyper-V console;
  • USB redirection via RDP ;
  • Using a software/hardware solution for USB network redirection (USB over IP).

In the latter scenario, third party solutions are used to implement USB over IP. This may be a USB network hub, a software solution that allows a USB device to be redirected from another server over a TCP/IP network. The most common commercial solutions are fee-based solutions (AnywhereUSB, DigiUSB). Free projects include VirtualHere USB (free for a USB stick and a target server) and a fairly old open source project usbip.sourceforge.net (the server part is implemented on Linux, the client can be installed on Windows).

Accessing a USB disk from a Hyper-Vvirtual machine

You can redirect a USB drive attached to the host directly to a Hyper-V virtual machine with relative ease. Let’s see how to give a Hyper-V virtual machine direct access to a USB drive on the host.

  1. Connect an external USB drive to the Hyper-V host (this can be any host that has the Windows and Hyper-V roles installed, or a free Microsoft Hyper-V server). The drive appears in the system and is assigned a drive letter (if no drive letter is assigned, check the entry) ;
  2. Open the Disk Management Console (diskmgmt.msc), right-click on the disk (in our example, the 20GB USB drive ID is disk 1) and select Offline. Error! The file name is not specified.

If you are using a Windows Server Core or Hyper-V server that does not have mmc snap-ins, you can manage local disks using the PowerShell Disk Management Module. Use the following commands to list the physical drives on the host and take the specified drive offline:
Get-Disk -Number 1 |Set-Disk -IsOffline:$true
Error! The file name is not specified.

  1. Start Hyper-V Manager and open the properties of the virtual machine you want to connect the USB stick to. Under SCSI Controller, add a new disk and specify that it is a physical disk (physical hard drive). Select your USB drive from the drop-down menu (it looks like this: Disk 1 20.00 Gb Bus 0 Month 0 Target 1).

Pay attention. It is not necessary to stop the virtual machine to add a SCSI disk. For SCSI devices, hot add and hot remove disks are supported.

Error! The file name is not specified.

  1. Now we will show you how to access USB flash drives on a Hyper-V host from a Windows virtual machine guest OS. Open the virtual machine console or connect to it via RDP. Log in to the guest operating system. Start the Disk Manager. The operating system needs to see the new drive. If it is offline, right click on it and select Online. No drive letter or mount point is currently assigned to the USB drive partitions. To fix this, right-click on the hard drive partition and select Change Drive Letter and Path from the context menu. Assign a free drive letter to the partition or specify a confirmation point. Error! The file name is not specified.

That’s it! You have connected an external USB stick directly to a Hyper-V virtual machine and are now ready to use it.

Important. To avoid data loss, before you physically remove the hard drive from the USB port, make sure that no application in the virtual machine can access the hard drive.

To safely remove the USB drive, open the Hyper-V Manager console and go to the Virtual Machine Settings window. Under SCSI Controller, select the hard drive you want to remove and click Delete. Save your changes. You can then physically remove the disk from the USB port of the Hyper-V host.

Redirecting a USB device to a virtual machine in Hyper-V Enhanced Session Mode

With the version of Hyper-V introduced with Windows Server 2012 R2/8.1, any USB device can be redirected from the client computer to a virtual machine using Enhanced Session Mode (ESM). The Hyper-V Manager tool vmconnect.exe is used for the connection. This allows you to connect to the virtual machine’s console and select the USB devices you want to forward.

First, you need to enable advanced session mode in the Hyper-V server settings. This can be done with PowerShell:

Set-VMHost -EnableEnhancedSessionMode $true

Or in the Hyper-V settings -> Advanced Session Mode.

Error! The file name is not specified.

Restart the Hyper-V virtual machine management service:
Get vmms service | Restart service

The Visitor Services option must be enabled in the Service Integration section of the VM settings.

To reroute the USB device using the advanced session mode, open the Hyper-V console, select the virtual machine, and click the Connect button. You can also run the vmconnect.exe (Virtual Machine Connection) tool, specify the Hyper-V server and the name of the virtual machine. The vmconnect tool supports some command line options, so you can provide the user with a custom bat file with the desired options.

Error! The file name is not specified.

If the VM supports extended session mode, a window similar to the RDP connection properties appears. Click View -> Local Sources -> Device and Local Sources -> Details.

Error! The file name is not specified.

Select the USB devices on the computer to redirect to the VM. If the device you want to connect is not currently connected, select Other Plug and Play (PnP) compatible devices and Devices I want to connect later.

Error! The file name is not specified.

All USB devices connected to the computer are now automatically available in the console session of the Hyper-V virtual machine.

Key features and limitations of Hyper-V enhanced session mode :

  • Only Windows (from Windows 8.1 / Windows Server 2012 R2) is supported as a guest operating system;
  • You do not need direct network access to the virtual machine. All connections are made by the Hyper-V host (you connect to it via TCP port 2179) and Hyper-V connects to the VMs via VMBus ;
  • Hyper-V Manager must be installed on the client computer.

This method is similar to redirecting USB devices from the local host via an RDP session. We will not pursue this matter further. Error! The file name is not specified.

If you redirect USB devices over the network (USB over IP or RDP session), you can still access the USB drive after migrating the virtual machine to another host (Hyper-V Live Migration / vMotion).

hyper-v usb dongle passthroughconnect external hard drive to virtual machine hyper-vhyper-v usb serial passthroughhyper-v usb passthrough scannerhyper-v usb wifi passthroughhyper-v passthrough usb devicehyper-v usb camerahyper-v boot from usb

You May Also Like

How to Download and Install Facebook Messenger on Windows 10 PC

Until recently, Facebook Messenger on Facebook could only be used with a…

Steps To Start And Join Live Voice Chat On Telegram

To attract more users to its cloud-based instant messaging solution, Telegram announced…

Something went wrong while downloading your template [Fix]

How to correct an error when loading a model? 1. Retrieve a…

Why Choosing an ITAD Company is Important to your Business

The destruction of hard drives as a means of data protection is…