If you are using Windows and looking for a way to share a USB device either over the network to other machines, or to Hyper-V or WSL 2 virtual machines, you need to use what is called USB-IP. This can allow you to share a scanner or an old printer between multiple computers on the same network.
This is what the utility (well known to Linux users) called usbipd allows, and a Windows version can be downloaded here. You can also install it via Winget using the following command:
winget install usbipd
Once installed, the tool is used via command line and allows all devices available on the network to connect to the USB device of your choice. Rest assured, by default, nothing is shared. You will need to list the devices with the following command:
You will then get a list of your devices. They will have an ID like: 3-1, 3-5…etc. To put it on the network, you will then launch the following command:
usbipd bind --busid=X-X
(Replace x-x with 3-5 for example)
Then, to connect, use the following command on the remote system:
usbip list --remote=HOST
And replace HOST with the IP of the machine and voila, you will have access to the USB device as if it were plugged into your own machine. Depending on your network, there may be some small latency or bandwidth issues.
You can also use the “usbipd wsl” subcommand to share and connect a device with a single command under WSL2. Note that it is possible to do this via a graphical interface with this tool.