How to enable Hyper-V USB passthrough
Here you will find out:
- what is Hyper-V USB passthrough
- what do you need to use Hyper-V USB passthrough
- when DiskInternals can help you
Are you ready? Let's read!
The abstraction of the hardware is one of the most important aspects of virtualization. It concentrates on the CPU, disk, and memory since they are required by all operating systems and applications. These resources are shared even on non-virtualized systems. Other hardware components, which are not shared even across independent apps, make virtualization more difficult. USB devices are included in the latter category. At any given moment, USB devices expect to connect with just one subsystem or application. As a result, USB in virtualized systems presents unique challenges.
What Is Hyper-V USB Passthrough?
The USB passthrough feature allows you to use a USB device from within a virtual machine. Unfortunately, USB passthrough is not natively supported in Hyper-V environments. However, you may still use the following methods to accomplish Hyper-V USB passthrough:
- Activate the Enhanced Session Mode.
- Start an RDP (Remote Desktop Protocol) session.
- Install USB solutions that are network-based.
- Install USB solutions that are software-based.
Because the first two options do not involve the installation of third-party software and can be manually customized in a few minutes, this article will discuss how they function.
Requirements for Hyper-V USB passthrough
In a nutshell, you must fulfill the following conditions to provide the VM access to a local resource:
- The Enhanced session mode policy should be activated, as well as the Enhanced session mode settings. Only generation 2 VMs support Enhanced Session Mode.
- Your machine must be running Windows Server 2016, Windows 10, Windows 8.1, Windows Server 2012 R2, Windows Server 2012, or Windows 8 for Virtual Machine Connection (VMConnect) to operate.
- Windows Server 2016, Windows Server 2012 R2, Windows 10, or Windows 8.1 must be installed on the virtual machine from which we wish to connect to a USB drive.
- On the VM you want to connect to, Remote Desktop Services must be enabled.
How to Add Hyper-V Passthrough Support for USB Drives
Most USB disk drives can be set up in passthrough mode by Hyper-V, although it does it through Windows' storage subsystem. Because only one component can connect with a USB device, the Windows disk subsystem acts as a middleman for all USB storage devices. As a result, in order for your USB drive to connect in passthrough mode, Windows must recognize it as a "Mass Storage Device." Other USB storage devices aren't compatible.
1. In Disk Management, make sure the disk is visible. Remove it off the internet. The disk cannot be utilized as a passthrough if the Offline option is not present.
2. Click the virtual controller where you want to add your passthrough disk in the target virtual machine's properties window. On the right, make sure Hard Drive is chosen, then click Add. You can't add a disk to a virtual IDE controller while the virtual machine is running, but you can add one to a virtual SCSI controller whether the virtual machine is running or not.
3. To attach a disk, change the selection dot to Physical Hard Disk and then choose the drive from the drop-down menu. Click the OK button.
Hyper-V Cannot Passthrough Non-Disk USB
I've seen a lot of concerns about Hyper-V not being able to pass over USB devices. The issue is usually accompanied by a bad comparison to apps that can do USB passthrough, such as VMware Workstation and Oracle VirtualBox.
The distinction to be made here is that Hyper-V is a type 1 hypervisor, whereas type 2 hypervisors enable simple USB passthrough. The management operating system is put directly on the hardware in a type 2 hypervisor, and the hypervisor is merely another program that runs within it. Apps may capture a USB port solely to prohibit other applications from utilizing it if they want to, which is why it's so simple under a type 2 hypervisor.
If you've ever used a type 2 hypervisor in this fashion, you'll note that they expressly state that the USB device can be attached to either the parent or the guest - there's no sharing, resource access divvying up, or anything like that.
Hypervisors of type 1 are not applications. Kernels that are securely embedded into partitions. A type 2 hypervisor is just an application shim that pretends to be a root hardware device, which is OK because it doesn't need as much isolation as a type 1 hypervisor.
Because one operating system instance locking a USB port from all other operating system instances isn't how type 1 virtualization works, Hyper-V can't accomplish it. Is it possible for a type 1 hypervisor to allocate a USB port to a specific guest in the same manner as a type 2 hypervisor does?
It appears to be something that could be done in principle. However, technological feasibility is irrelevant. It's not possible with Hyper-V. If you want to learn more, Microsoft has written a detailed post about passing through hardware on the 2016 platform, which covers some of the problems and opportunities.
Hyper-V is a terrible answer if real USB passthrough is a must for whatever you've got in mind. You're kind of pushed into it if you use the emulators in Visual Studio. For the rest of you, I'd recommend looking at a type 2 hypervisor. VirtualBox is one of my favorite programs. It's far from ideal, but the license conditions are reasonable for most users, and it gets the job done.
Should Hyper-V Have USB Passthrough?
While the globe progressed, this piece had some time to bake in the sun. My early ideas on the matter were as follows:
Hyper-V is, first and foremost, a server-based solution. Beyond that, Microsoft is enthusiastically adopting cloud principles, even to the exclusion of many other technologies, in my opinion. When you consider a virtualization-based cloud, even an on-premises cloud, it's easy to understand why host-based USB is a bad choice. You can never be sure whether or not a virtual machine will be running at any given time. Even the absence of a cluster no longer binds a virtual machine to a specific host with Shared Nothing Live Migration. It just doesn't make sense to use USB as a host.
After further thought, I still hold that position in terms of servers, datacenters, and cloud computing. However, Client Hyper-V has been embraced by considerably more users in the ensuing years. In Windows 10, virtual machines have a lot less mobility issues. Furthermore, there are significantly more compelling reasons for Windows 10 customers to demand USB passthrough. However, as the "Method 3" debate shows, Microsoft does offer a method that includes outsourcing the USB connection to its console software. Regrettably, this is only partially applicable.
Should we thus expect Microsoft to make an attempt to develop a proper USB passthrough solution? I'm still leaning toward "no," simply because it would need a significant amount of effort, and the console solution's scope would ultimately align with the guest operating systems that people use.
Method 1: Network-Based USB Solutions
Favor network-based options if you need to make a USB device available in your virtualized datacenter. Use a Digi product. This isn't really an endorsement because I've only used one of their devices and haven't tried any of their newer technologies, but they're still in business, so they must be doing something well. Keep in mind that USB hubs, not ports, have a one-to-one match with operating systems. If you want to connect a lot of virtual computers, don't buy a single device with a lot of ports.
Method 2: Remote Desktop Protocol
Once an operating system is installed on a virtual computer, it acts similarly to a real machine. So, under the System properties panel, you may allow remote desktop connections:
After that, you may connect to it remotely just like any other Windows machine.
To allow USB devices in an RDP session, follow these steps:
- 1. Run mstsc.exe at a Run/command prompt.
- 2. Click Show Options:
- 3. The dialog box will expand, exposing a number of tabs. Switch to the Local Resources tab and click the More button:
- 4. Another dialog will appear. Other devices that it detects will appear here, as will a checkbox for Other supported Plug and Play (PnP) devices. Check items as necessary.
These parameters will be preserved until you modify them after clicking OK and connecting to an RDP connection on any host. A useful utility named "Remote Desktop Connection Manager" is also available. It's a little quirky and unreliable, but the ability to save a lot of unique connection parameters for distant hosts in a hierarchical tree makes up for the slight drawbacks.
Method 3: Enhanced Session Mode USB Connectivity
The last approach is the most dependable, but it also comes with the greatest limitations. The 2012 version of Hyper-V featured Enhanced Session Mode, which was bundled with Windows 8's Client Hyper-V.
Many of RDP's session technologies are merged into the VMConnect.exe program using this technology. If the name of that program doesn't strike a bell, Hyper-V Manager and Failover Cluster Manager will launch it when you select Connect from the menu bar.
You may also execute it from a command prompt by typing vmconnect.exe (elevation is typically required).
VMConnect is the console application for Hyper-V. Hyper-V virtual computers, like real systems in a datacenter, may run whether or not a console is attached. Keyboard, video, and mouse functions are all provided via hypervisor console programs. Type 2 hypervisors with more experience tend to have more robust consoles. Because Hyper-client V's program hasn't had nearly as much time to develop as the Remote Desktop client, it uses capabilities from the latter to provide Enhanced Session Mode.
How to enable enhanced session mode in Hyper-V USB Passthrough
Enhanced Session Mode is enabled by default in client Hyper-V deployments. You must manually activate it for the server SKUs. The Hyper-V Virtual Machine Management service must then be restarted (vmms). PowerShell is the fastest method:
Set-VMHost -EnableEnhancedSessionMode $true
That cmdlet includes the -ComputerName parameter if you’re running it remotely.
If you prefer Hyper-V Manager:
- 1. Right-click on the host in the left pane. Click Hyper-V Settings.
- 2. In the left-side tabs, click Enhanced Session Mode Policy.
- 3. Check the box for Allow enhanced session mode and click OK.
It is not necessary to enable the Guest services integration service just to enable USB redirection.
Enhanced Session Mode is best employed with Client Hyper-V, and it's the closest you'll come to type 2 hypervisor capabilities. It's important to remember that because it's based on RDP technology, it's not genuinely "passing through" the USB device. Some devices may not function as well as they do with type 2 hypervisors, while others may not function at all.