Attach USB device to Hyper-V guest machine

Omid Shojaee 121 Reputation points
2022-01-24T12:21:15.937+00:00

Hello,

We have a software installed on one of our Hyper-V guest machines running Windows 2022 Datacenter edition. This software requires a hardware lock which is a USB device. The device is inserted into the USB port of the server, and the host machine sees it as an Input Device.

I need to somehow "attach" that USB device to the guest machine permanently and make it visible to the guest OS otherwise that software won't work. What is the solution?

The host machine is Windows 2022 Datacenter edition.

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,636 questions
{count} votes

7 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    10 deleted comments

    Comments have been turned off. Learn more

  2. Some One 51 Reputation points
    2022-08-28T02:16:05.917+00:00

    @Leon Laude , seems you are avoiding the real question...

    The answer is a big NO. Hyper-V CANNOT have pass-trough USB device other then storage. I.e. No ZigBee dongle, No Intel Neural Net USB dongles, no MFA/2FA dongles, not crypto tokens. I'm very surprised as VMWare ESXi had it up front in the beginning in early versions and it works great, and no "special disabling" of the device is required LOL.

    very disappointed in Microsoft yet again.

    10 people found this answer helpful.

  3. Tom-9560 15 Reputation points
    2023-06-21T08:44:15.5866667+00:00

    This is M$ Shame #56510

    While even open-source hypervisor supports real USB Passthrough,

    M$, after decades, is still limited to just attach USB Drives if they are willing follow a nightmare process with 20 steps.

    Isn't Microsoft even able to peek e.g. virtual box source code so get smart and understand how one could write SW to allow real USB Passthrough?

    3 people found this answer helpful.
    0 comments No comments

  4. Net Runner 605 Reputation points
    2024-03-07T09:50:56.0466667+00:00

    What is the solution?

    The only solution I know to work reliably in this particular use case is either using a different hypervisor (VMware ESXi or Linux KVM) or USB-over-Ethernet software, like this one https://www.eltima.com/de/products/usb-over-ethernet/.

    Another alternative is to purchase a dedicated PCIe USB controller (they are cheap) and pass it to your virtual machine entirely with the USB key plugged into it. That works most of the time.

    You may also ask your software vendor for options other than a USB key. Usually, they offer some network- or online-based alternatives.

    2 people found this answer helpful.
    0 comments No comments

  5. Alex Calugarescu 5 Reputation points
    2024-01-05T07:53:40.0266667+00:00

    My setup is:

    Hyper V Server (i.e. the bare metal hypervisor only, but this guide should also work on Windows Servers)

    Ubuntu VM (named Leya) which runs on the HyperV Server with OpenHab and a ZWave USB dongle.

    1. Create the VmComport:
          Set-VMComPort -VMName 'Leya' -Number 1 -Path \\.\pipe\aeontech 
      
      Note: you can whatever name you want for your pipe.
    2. Install COMpipe
      1. Install Visual C++ Redistributable since Hyper V does not come with it preinstalled. You can download it from here: https://aka.ms/vs/17/release/vc_redist.x64.exe
      2. Download COMpipe from here: https://github.com/tdhoward/COMpipe/tree/master/x64/Release
      3. Find the USB COM port by running:
                                Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB' } | Select-Object Name,Description,InstanceId
        
        You should have a line like: USB Serial Device (COM3) USB Serial Device USB\VID_0658&PID_0200\5&1E7D8DB7&0&5
      4. Run COMpipe:
                .\COMpipe.exe -c \\.\COM3 -p \\.\pipe\aeontech
        
      5. On the VM, the COM port will be available as /dev/ttyS0
    3. As a final step, start COMpipe as a windows service. I used this service manager: https://nssm.cc/builds. The alternative is to start COMpipe manually but keep in mind this has to be done on every VM restart.
    1 person found this answer helpful.